Path: blob/master/src/java.base/share/classes/java/io/IOException.java
41152 views
/*1* Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.io;2627/**28* Signals that an I/O exception of some sort has occurred. This29* class is the general class of exceptions produced by failed or30* interrupted I/O operations.31*32* @see java.io.InputStream33* @see java.io.OutputStream34* @since 1.035*/36public class IOException extends Exception {37@java.io.Serial38static final long serialVersionUID = 7818375828146090155L;3940/**41* Constructs an {@code IOException} with {@code null}42* as its error detail message.43*/44public IOException() {45super();46}4748/**49* Constructs an {@code IOException} with the specified detail message.50*51* @param message52* The detail message (which is saved for later retrieval53* by the {@link #getMessage()} method)54*/55public IOException(String message) {56super(message);57}5859/**60* Constructs an {@code IOException} with the specified detail message61* and cause.62*63* <p> Note that the detail message associated with {@code cause} is64* <i>not</i> automatically incorporated into this exception's detail65* message.66*67* @param message68* The detail message (which is saved for later retrieval69* by the {@link #getMessage()} method)70*71* @param cause72* The cause (which is saved for later retrieval by the73* {@link #getCause()} method). (A null value is permitted,74* and indicates that the cause is nonexistent or unknown.)75*76* @since 1.677*/78public IOException(String message, Throwable cause) {79super(message, cause);80}8182/**83* Constructs an {@code IOException} with the specified cause and a84* detail message of {@code (cause==null ? null : cause.toString())}85* (which typically contains the class and detail message of {@code cause}).86* This constructor is useful for IO exceptions that are little more87* than wrappers for other throwables.88*89* @param cause90* The cause (which is saved for later retrieval by the91* {@link #getCause()} method). (A null value is permitted,92* and indicates that the cause is nonexistent or unknown.)93*94* @since 1.695*/96public IOException(Throwable cause) {97super(cause);98}99}100101102