Package org.apache.commons.io
Class CloseableURLConnection
java.lang.Object
java.net.URLConnection
org.apache.commons.io.CloseableURLConnection
- All Implemented Interfaces:
AutoCloseable
Delegates to a URLConnection while implementing AutoCloseable.
-
Field Summary
FieldsFields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRequestProperty
(String key, String value) void
close()
void
connect()
boolean
boolean
int
getContent
(Class[] classes) int
long
long
getDate()
boolean
boolean
boolean
long
getHeaderField
(int n) getHeaderField
(String name) long
getHeaderFieldDate
(String name, long Default) int
getHeaderFieldInt
(String name, int Default) getHeaderFieldKey
(int n) long
getHeaderFieldLong
(String name, long Default) long
long
int
getRequestProperty
(String key) getURL()
boolean
int
hashCode()
(package private) static CloseableURLConnection
(package private) static CloseableURLConnection
void
setAllowUserInteraction
(boolean allowUserInteraction) void
setConnectTimeout
(int timeout) void
setDefaultUseCaches
(boolean defaultUseCaches) void
setDoInput
(boolean doInput) void
setDoOutput
(boolean doOutput) void
setIfModifiedSince
(long ifModifiedSince) void
setReadTimeout
(int timeout) void
setRequestProperty
(String key, String value) void
setUseCaches
(boolean useCaches) toString()
-
Field Details
-
urlConnection
-
-
Constructor Details
-
CloseableURLConnection
CloseableURLConnection(URLConnection urlConnection)
-
-
Method Details
-
open
- Throws:
IOException
-
open
- Throws:
IOException
-
addRequestProperty
- Overrides:
addRequestProperty
in classURLConnection
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
connect
- Specified by:
connect
in classURLConnection
- Throws:
IOException
-
equals
-
getAllowUserInteraction
public boolean getAllowUserInteraction()- Overrides:
getAllowUserInteraction
in classURLConnection
-
getConnectTimeout
public int getConnectTimeout()- Overrides:
getConnectTimeout
in classURLConnection
-
getContent
- Overrides:
getContent
in classURLConnection
- Throws:
IOException
-
getContent
- Overrides:
getContent
in classURLConnection
- Throws:
IOException
-
getContentEncoding
- Overrides:
getContentEncoding
in classURLConnection
-
getContentLength
public int getContentLength()- Overrides:
getContentLength
in classURLConnection
-
getContentLengthLong
public long getContentLengthLong()- Overrides:
getContentLengthLong
in classURLConnection
-
getContentType
- Overrides:
getContentType
in classURLConnection
-
getDate
public long getDate()- Overrides:
getDate
in classURLConnection
-
getDefaultUseCaches
public boolean getDefaultUseCaches()- Overrides:
getDefaultUseCaches
in classURLConnection
-
getDoInput
public boolean getDoInput()- Overrides:
getDoInput
in classURLConnection
-
getDoOutput
public boolean getDoOutput()- Overrides:
getDoOutput
in classURLConnection
-
getExpiration
public long getExpiration()- Overrides:
getExpiration
in classURLConnection
-
getHeaderField
- Overrides:
getHeaderField
in classURLConnection
-
getHeaderField
- Overrides:
getHeaderField
in classURLConnection
-
getHeaderFieldDate
- Overrides:
getHeaderFieldDate
in classURLConnection
-
getHeaderFieldInt
- Overrides:
getHeaderFieldInt
in classURLConnection
-
getHeaderFieldKey
- Overrides:
getHeaderFieldKey
in classURLConnection
-
getHeaderFieldLong
- Overrides:
getHeaderFieldLong
in classURLConnection
-
getHeaderFields
- Overrides:
getHeaderFields
in classURLConnection
-
getIfModifiedSince
public long getIfModifiedSince()- Overrides:
getIfModifiedSince
in classURLConnection
-
getInputStream
- Overrides:
getInputStream
in classURLConnection
- Throws:
IOException
-
getLastModified
public long getLastModified()- Overrides:
getLastModified
in classURLConnection
-
getOutputStream
- Overrides:
getOutputStream
in classURLConnection
- Throws:
IOException
-
getPermission
- Overrides:
getPermission
in classURLConnection
- Throws:
IOException
-
getReadTimeout
public int getReadTimeout()- Overrides:
getReadTimeout
in classURLConnection
-
getRequestProperties
- Overrides:
getRequestProperties
in classURLConnection
-
getRequestProperty
- Overrides:
getRequestProperty
in classURLConnection
-
getURL
- Overrides:
getURL
in classURLConnection
-
getUseCaches
public boolean getUseCaches()- Overrides:
getUseCaches
in classURLConnection
-
hashCode
public int hashCode() -
setAllowUserInteraction
public void setAllowUserInteraction(boolean allowUserInteraction) - Overrides:
setAllowUserInteraction
in classURLConnection
-
setConnectTimeout
public void setConnectTimeout(int timeout) - Overrides:
setConnectTimeout
in classURLConnection
-
setDefaultUseCaches
public void setDefaultUseCaches(boolean defaultUseCaches) - Overrides:
setDefaultUseCaches
in classURLConnection
-
setDoInput
public void setDoInput(boolean doInput) - Overrides:
setDoInput
in classURLConnection
-
setDoOutput
public void setDoOutput(boolean doOutput) - Overrides:
setDoOutput
in classURLConnection
-
setIfModifiedSince
public void setIfModifiedSince(long ifModifiedSince) - Overrides:
setIfModifiedSince
in classURLConnection
-
setReadTimeout
public void setReadTimeout(int timeout) - Overrides:
setReadTimeout
in classURLConnection
-
setRequestProperty
- Overrides:
setRequestProperty
in classURLConnection
-
setUseCaches
public void setUseCaches(boolean useCaches) - Overrides:
setUseCaches
in classURLConnection
-
toString
- Overrides:
toString
in classURLConnection
-