Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Possible Duplicate: How to terminate a thread blocking on socket IO operation instantly? I have client run in thread want to read from socket in Java. But while reading, maybe I want to kill the thread. So I interrupt it, but does socket's reading methods throw InterruptedException? I didn't find. So, how can I nicely ask thread to die while it's blocking on reading socket? Thanks
What Exception is thrown on connection timeout in HTMLUnit ?
In my application I download several critical files from a server, and I want to write some code that handles the case where the a file download didn't complete for a reason or other ,to retry downloading it at next startup. The function that downloads a file at a time however throws only MalformedURLException and IOException , but if these exceptions are thrown that means that the download di...
 /*
  * Copyright 1995-2000 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Sun designates this
  * particular file as subject to the "Classpath" exception as provided
  * by Sun in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit www.sun.com if you need additional information or
 * have any questions.
 */
package java.io;

Signals that an I/O operation has been interrupted. An InterruptedIOException is thrown to indicate that an input or output transfer has been terminated because the thread performing it was interrupted. The field bytesTransferred indicates how many bytes were successfully transferred before the interruption occurred.

Author(s):
unascribed
Since:
JDK1.0
See also:
InputStream
OutputStream
java.lang.Thread.interrupt()
public
class InterruptedIOException extends IOException {
    
Constructs an InterruptedIOException with null as its error detail message.
    public InterruptedIOException() {
        super();
    }

    
Constructs an InterruptedIOException with the specified detail message. The string s can be retrieved later by the java.lang.Throwable.getMessage() method of class java.lang.Throwable.

Parameters:
s the detail message.
    public InterruptedIOException(String s) {
        super(s);
    }

    
Reports how many bytes had been transferred as part of the I/O operation before it was interrupted.

Serial:
    public int bytesTransferred = 0;
New to GrepCode? Check out our FAQ X