KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > schlichtherle > io > InputIOException


1 /*
2  * InputIOException.java
3  *
4  * Created on 8. Januar 2006, 19:41
5  */

6 /*
7  * Copyright 2006 Schlichtherle IT Services
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */

21
22 package de.schlichtherle.io;
23
24 import java.io.FileNotFoundException JavaDoc;
25 import java.io.IOException JavaDoc;
26
27 /**
28  * Thrown to indicate that an {@link IOException} happened on the input side
29  * rather than the output side when copying an InputStream to an OutputStream.
30  * This exception is always initialized with an <code>IOException</code> as
31  * its cause, so it is safe to cast the return value of
32  * {@link Throwable#getCause} to an <code>IOException</code>.
33  *
34  * @author Christian Schlichtherle
35  * @version @version@
36  */

37 public class InputIOException extends IOException JavaDoc {
38
39     /**
40      * Constructs a new <code>InputIOException</code>.
41      *
42      * @param cause A valid <code>IOException</code>.
43      * This must not be <code>null</code> and must not be an instance
44      * of {@link FileNotFoundException} (which means that they cannot
45      * not be masked).
46      * @throws NullPointerException If <code>cause</code> is <code>null</code>.
47      * @throws IllegalArgumentException If <code>cause</code> is an instance of
48      * <code>FileNotFoundException</code>.
49      */

50     public InputIOException(final IOException JavaDoc cause) {
51         super(cause.getLocalizedMessage());
52         if (cause instanceof FileNotFoundException JavaDoc) {
53             final IllegalArgumentException JavaDoc iae = new IllegalArgumentException JavaDoc();
54             iae.initCause(cause);
55             throw iae;
56         }
57         initCause(cause);
58     }
59 }
60
Popular Tags