1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. Oracle designates this 9 * particular file as subject to the "Classpath" exception as provided 10 * by Oracle in the LICENSE file that accompanied this code. 11 * 12 * This code is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * version 2 for more details (a copy is included in the LICENSE file that 16 * accompanied this code). 17 * 18 * You should have received a copy of the GNU General Public License version 19 * 2 along with this work; if not, write to the Free Software Foundation, 20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 * 22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 * or visit www.oracle.com if you need additional information or have any 24 * questions. 25 */ 26 27 package java.io; 28 29 /** 30 * Signals that an I/O operation has been interrupted. An 31 * <code>InterruptedIOException</code> is thrown to indicate that an 32 * input or output transfer has been terminated because the thread 33 * performing it was interrupted. The field {@link #bytesTransferred} 34 * indicates how many bytes were successfully transferred before 35 * the interruption occurred. 36 * 37 * @author unascribed 38 * @see java.io.InputStream 39 * @see java.io.OutputStream 40 * @see java.lang.Thread#interrupt() 41 * @since JDK1.0 42 */ 43 public 44 class InterruptedIOException extends IOException { 45 private static final long serialVersionUID = 4020568460727500567L; 46 47 /** 48 * Constructs an <code>InterruptedIOException</code> with 49 * <code>null</code> as its error detail message. 50 */ InterruptedIOException()51 public InterruptedIOException() { 52 super(); 53 } 54 55 /** 56 * Constructs an <code>InterruptedIOException</code> with the 57 * specified detail message. The string <code>s</code> can be 58 * retrieved later by the 59 * <code>{@link java.lang.Throwable#getMessage}</code> 60 * method of class <code>java.lang.Throwable</code>. 61 * 62 * @param s the detail message. 63 */ InterruptedIOException(String s)64 public InterruptedIOException(String s) { 65 super(s); 66 } 67 68 /** 69 * Reports how many bytes had been transferred as part of the I/O 70 * operation before it was interrupted. 71 * 72 * @serial 73 */ 74 public int bytesTransferred = 0; 75 76 // Android-added: Additional constructor for internal use. 77 /** @hide */ InterruptedIOException(Throwable cause)78 public InterruptedIOException(Throwable cause) { 79 super(cause); 80 } 81 82 // Android-added: Additional constructor for internal use. 83 /** 84 * Constructs a new instance with given detail message and cause. 85 * 86 * @hide internal use only 87 */ InterruptedIOException(String detailMessage, Throwable cause)88 public InterruptedIOException(String detailMessage, Throwable cause) { 89 super(detailMessage, cause); 90 } 91 } 92