diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-12-10 19:35:37 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-12-10 19:35:37 +0000 |
commit | f4b2de8ebb01a1e4a906682edaa17785fff813c9 (patch) | |
tree | caae0a89736a380f7879b2181ad999725ac83f5b /java/net/URLConnection.java | |
parent | d1b6fb1ce48424b1eb608f8432a758627a3ba25d (diff) | |
download | classpath-generics-stoppoint.tar.gz |
2006-12-10 Andrew John Hughes <gnu_andrew@member.fsf.org>generics-stoppoint
* Merge of HEAD-->generics-branch for
classpath-0.93-branch-point to generics-mergepoint
Diffstat (limited to 'java/net/URLConnection.java')
-rw-r--r-- | java/net/URLConnection.java | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/java/net/URLConnection.java b/java/net/URLConnection.java index 325ff2329..674058014 100644 --- a/java/net/URLConnection.java +++ b/java/net/URLConnection.java @@ -175,9 +175,14 @@ public abstract class URLConnection private static boolean dateformats_initialized; /** - * The timeout period. + * The connection timeout period. */ - private int timeout; + private int connectTimeout; + + /** + * The read timeout period. + */ + private int readTimeout; /* Cached ParsePosition, used when parsing dates. */ private ParsePosition position; @@ -217,8 +222,8 @@ public abstract class URLConnection } /** - * Returns the connection timeout speed, in milliseconds, or zero if the timeout - * is infinite or not set. + * Returns the connection timeout speed, in milliseconds, or zero if + * the timeout is infinite or not set. * * @return The timeout. * @@ -226,7 +231,7 @@ public abstract class URLConnection */ public int getConnectTimeout() { - return timeout; + return connectTimeout; } /** @@ -236,7 +241,7 @@ public abstract class URLConnection * * Throws an <code>IllegalArgumentException</code> if timeout < 0. * - * @param timeout - The timeout, in milliseconds. + * @param timeout the timeout, in milliseconds. * * @since 1.5 */ @@ -245,7 +250,45 @@ public abstract class URLConnection { if( timeout < 0 ) throw new IllegalArgumentException("Timeout must be 0 or positive."); - this.timeout = timeout; + connectTimeout = timeout; + } + + /** + * Returns the read timeout, in milliseconds, or zero if the timeout + * is infinite or not set. + * + * @return The timeout. + * + * @see #setReadTimeout + * + * @since 1.5 + */ + public int getReadTimeout() + { + return readTimeout; + } + + /** + * Set the read timeout, in milliseconds, or zero if the timeout + * is to be considered infinite. Note that in certain socket + * implementations/platforms this method may not have any effect. + * + * Throws an <code>IllegalArgumentException</code> if timeout < 0. + * + * @param timeout - The timeout, in milliseconds. + * + * @throws IllegalArgumentException if timeout is negative. + * + * @see #getReadTimeout + * + * @since 1.5 + */ + public void setReadTimeout(int timeout) + throws IllegalArgumentException + { + if( timeout < 0 ) + throw new IllegalArgumentException("Timeout must be 0 or positive."); + readTimeout = timeout; } /** |