|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jscape.inet.util.TimedURLConnection
public class TimedURLConnection
Implements methods for opening an InputStream or OutputStream on a URLConnection within a desired timeout. *
Example Usage:int timeout = 5000; // 5 second timeout try { URL url = new URL("http://www.myserver.com"); URLConnection conn = url.openConnection(); InputStream in = TimedURLConnection.getInputStream(conn,timeout); } catch(Exception ioe) { // handle exception }
Method Summary | |
---|---|
static java.io.InputStream |
getInputStream(java.net.URLConnection conn,
int delay)
Gets InputStream from a URLConnection within a specified timeout. |
static java.io.OutputStream |
getOutputStream(java.net.URLConnection conn,
int delay)
Gets OutputStream from a URLConnection within a specified timeout. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.io.OutputStream getOutputStream(java.net.URLConnection conn, int delay) throws java.io.IOException
conn
- the URLConnectiondelay
- timeout in milliseconds
java.io.IOException
- timeout is reached or other I/O error occurspublic static java.io.InputStream getInputStream(java.net.URLConnection conn, int delay) throws java.io.InterruptedIOException, java.io.IOException
URLConnection
within a specified timeout.
conn
- the URLConnection
delay
- timeout in milliseconds
java.io.IOException
- timeout is reached or other I/O error occurs
java.io.InterruptedIOException
|
Secure iNet Factory | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |