• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 1994, 2006, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package java.io;
27 
28 /**
29  * Signals that an I/O exception of some sort has occurred. This
30  * class is the general class of exceptions produced by failed or
31  * interrupted I/O operations.
32  *
33  * @author  unascribed
34  * @see     java.io.InputStream
35  * @see     java.io.OutputStream
36  * @since   JDK1.0
37  */
38 public
39 class IOException extends Exception {
40     static final long serialVersionUID = 7818375828146090155L;
41 
42     /**
43      * Constructs an {@code IOException} with {@code null}
44      * as its error detail message.
45      */
IOException()46     public IOException() {
47         super();
48     }
49 
50     /**
51      * Constructs an {@code IOException} with the specified detail message.
52      *
53      * @param message
54      *        The detail message (which is saved for later retrieval
55      *        by the {@link #getMessage()} method)
56      */
IOException(String message)57     public IOException(String message) {
58         super(message);
59     }
60 
61     /**
62      * Constructs an {@code IOException} with the specified detail message
63      * and cause.
64      *
65      * <p> Note that the detail message associated with {@code cause} is
66      * <i>not</i> automatically incorporated into this exception's detail
67      * message.
68      *
69      * @param message
70      *        The detail message (which is saved for later retrieval
71      *        by the {@link #getMessage()} method)
72      *
73      * @param cause
74      *        The cause (which is saved for later retrieval by the
75      *        {@link #getCause()} method).  (A null value is permitted,
76      *        and indicates that the cause is nonexistent or unknown.)
77      *
78      * @since 1.6
79      */
IOException(String message, Throwable cause)80     public IOException(String message, Throwable cause) {
81         super(message, cause);
82     }
83 
84     /**
85      * Constructs an {@code IOException} with the specified cause and a
86      * detail message of {@code (cause==null ? null : cause.toString())}
87      * (which typically contains the class and detail message of {@code cause}).
88      * This constructor is useful for IO exceptions that are little more
89      * than wrappers for other throwables.
90      *
91      * @param cause
92      *        The cause (which is saved for later retrieval by the
93      *        {@link #getCause()} method).  (A null value is permitted,
94      *        and indicates that the cause is nonexistent or unknown.)
95      *
96      * @since 1.6
97      */
IOException(Throwable cause)98     public IOException(Throwable cause) {
99         super(cause);
100     }
101 }
102