URLConnection (Java Platform SE 7 ) (original) (raw)
Modifier and Type
Method and Description
void
**[addRequestProperty](../../java/net/URLConnection.html#addRequestProperty%28java.lang.String,%20java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") key,[String](../../java/lang/String.html "class in java.lang") value)
Adds a general request property specified by a key-value pair.
abstract void
**[connect](../../java/net/URLConnection.html#connect%28%29)**()
Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.
boolean
**[getAllowUserInteraction](../../java/net/URLConnection.html#getAllowUserInteraction%28%29)**()
Returns the value of the allowUserInteraction
field for this object.
int
**[getConnectTimeout](../../java/net/URLConnection.html#getConnectTimeout%28%29)**()
Returns setting for connect timeout.
[Object](../../java/lang/Object.html "class in java.lang")
**[getContent](../../java/net/URLConnection.html#getContent%28%29)**()
Retrieves the contents of this URL connection.
[Object](../../java/lang/Object.html "class in java.lang")
**[getContent](../../java/net/URLConnection.html#getContent%28java.lang.Class[]%29)**([Class](../../java/lang/Class.html "class in java.lang")[] classes)
Retrieves the contents of this URL connection.
[String](../../java/lang/String.html "class in java.lang")
**[getContentEncoding](../../java/net/URLConnection.html#getContentEncoding%28%29)**()
Returns the value of the content-encoding
header field.
int
**[getContentLength](../../java/net/URLConnection.html#getContentLength%28%29)**()
Returns the value of the content-length
header field.
long
**[getContentLengthLong](../../java/net/URLConnection.html#getContentLengthLong%28%29)**()
Returns the value of the content-length
header field as a long.
[String](../../java/lang/String.html "class in java.lang")
**[getContentType](../../java/net/URLConnection.html#getContentType%28%29)**()
Returns the value of the content-type
header field.
long
**[getDate](../../java/net/URLConnection.html#getDate%28%29)**()
Returns the value of the date
header field.
static boolean
**[getDefaultAllowUserInteraction](../../java/net/URLConnection.html#getDefaultAllowUserInteraction%28%29)**()
Returns the default value of the allowUserInteraction
field.
static [String](../../java/lang/String.html "class in java.lang")
**[getDefaultRequestProperty](../../java/net/URLConnection.html#getDefaultRequestProperty%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") key)
Deprecated.
The instance specific getRequestProperty method should be used after an appropriate instance of URLConnection is obtained.
boolean
**[getDefaultUseCaches](../../java/net/URLConnection.html#getDefaultUseCaches%28%29)**()
Returns the default value of a URLConnection
'suseCaches
flag.
boolean
**[getDoInput](../../java/net/URLConnection.html#getDoInput%28%29)**()
Returns the value of this URLConnection
'sdoInput
flag.
boolean
**[getDoOutput](../../java/net/URLConnection.html#getDoOutput%28%29)**()
Returns the value of this URLConnection
'sdoOutput
flag.
long
**[getExpiration](../../java/net/URLConnection.html#getExpiration%28%29)**()
Returns the value of the expires
header field.
static [FileNameMap](../../java/net/FileNameMap.html "interface in java.net")
**[getFileNameMap](../../java/net/URLConnection.html#getFileNameMap%28%29)**()
Loads filename map (a mimetable) from a data file.
[String](../../java/lang/String.html "class in java.lang")
**[getHeaderField](../../java/net/URLConnection.html#getHeaderField%28int%29)**(int n)
Returns the value for the n
th header field.
[String](../../java/lang/String.html "class in java.lang")
**[getHeaderField](../../java/net/URLConnection.html#getHeaderField%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") name)
Returns the value of the named header field.
long
**[getHeaderFieldDate](../../java/net/URLConnection.html#getHeaderFieldDate%28java.lang.String,%20long%29)**([String](../../java/lang/String.html "class in java.lang") name, long Default)
Returns the value of the named field parsed as date.
int
**[getHeaderFieldInt](../../java/net/URLConnection.html#getHeaderFieldInt%28java.lang.String,%20int%29)**([String](../../java/lang/String.html "class in java.lang") name, int Default)
Returns the value of the named field parsed as a number.
[String](../../java/lang/String.html "class in java.lang")
**[getHeaderFieldKey](../../java/net/URLConnection.html#getHeaderFieldKey%28int%29)**(int n)
Returns the key for the n
th header field.
long
**[getHeaderFieldLong](../../java/net/URLConnection.html#getHeaderFieldLong%28java.lang.String,%20long%29)**([String](../../java/lang/String.html "class in java.lang") name, long Default)
Returns the value of the named field parsed as a number.
[Map](../../java/util/Map.html "interface in java.util")<[String](../../java/lang/String.html "class in java.lang"),[List](../../java/util/List.html "interface in java.util")<[String](../../java/lang/String.html "class in java.lang")>>
**[getHeaderFields](../../java/net/URLConnection.html#getHeaderFields%28%29)**()
Returns an unmodifiable Map of the header fields.
long
**[getIfModifiedSince](../../java/net/URLConnection.html#getIfModifiedSince%28%29)**()
Returns the value of this object's ifModifiedSince
field.
[InputStream](../../java/io/InputStream.html "class in java.io")
**[getInputStream](../../java/net/URLConnection.html#getInputStream%28%29)**()
Returns an input stream that reads from this open connection.
long
**[getLastModified](../../java/net/URLConnection.html#getLastModified%28%29)**()
Returns the value of the last-modified
header field.
[OutputStream](../../java/io/OutputStream.html "class in java.io")
**[getOutputStream](../../java/net/URLConnection.html#getOutputStream%28%29)**()
Returns an output stream that writes to this connection.
[Permission](../../java/security/Permission.html "class in java.security")
**[getPermission](../../java/net/URLConnection.html#getPermission%28%29)**()
Returns a permission object representing the permission necessary to make the connection represented by this object.
int
**[getReadTimeout](../../java/net/URLConnection.html#getReadTimeout%28%29)**()
Returns setting for read timeout.
[Map](../../java/util/Map.html "interface in java.util")<[String](../../java/lang/String.html "class in java.lang"),[List](../../java/util/List.html "interface in java.util")<[String](../../java/lang/String.html "class in java.lang")>>
**[getRequestProperties](../../java/net/URLConnection.html#getRequestProperties%28%29)**()
Returns an unmodifiable Map of general request properties for this connection.
[String](../../java/lang/String.html "class in java.lang")
**[getRequestProperty](../../java/net/URLConnection.html#getRequestProperty%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") key)
Returns the value of the named general request property for this connection.
[URL](../../java/net/URL.html "class in java.net")
**[getURL](../../java/net/URLConnection.html#getURL%28%29)**()
Returns the value of this URLConnection
's URL
field.
boolean
**[getUseCaches](../../java/net/URLConnection.html#getUseCaches%28%29)**()
Returns the value of this URLConnection
'suseCaches
field.
static [String](../../java/lang/String.html "class in java.lang")
**[guessContentTypeFromName](../../java/net/URLConnection.html#guessContentTypeFromName%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") fname)
Tries to determine the content type of an object, based on the specified "file" component of a URL.
static [String](../../java/lang/String.html "class in java.lang")
**[guessContentTypeFromStream](../../java/net/URLConnection.html#guessContentTypeFromStream%28java.io.InputStream%29)**([InputStream](../../java/io/InputStream.html "class in java.io") is)
Tries to determine the type of an input stream based on the characters at the beginning of the input stream.
void
**[setAllowUserInteraction](../../java/net/URLConnection.html#setAllowUserInteraction%28boolean%29)**(boolean allowuserinteraction)
Set the value of the allowUserInteraction
field of this URLConnection
.
void
**[setConnectTimeout](../../java/net/URLConnection.html#setConnectTimeout%28int%29)**(int timeout)
Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this URLConnection.
static void
**[setContentHandlerFactory](../../java/net/URLConnection.html#setContentHandlerFactory%28java.net.ContentHandlerFactory%29)**([ContentHandlerFactory](../../java/net/ContentHandlerFactory.html "interface in java.net") fac)
Sets the ContentHandlerFactory
of an application.
static void
**[setDefaultAllowUserInteraction](../../java/net/URLConnection.html#setDefaultAllowUserInteraction%28boolean%29)**(boolean defaultallowuserinteraction)
Sets the default value of theallowUserInteraction
field for all futureURLConnection
objects to the specified value.
static void
**[setDefaultRequestProperty](../../java/net/URLConnection.html#setDefaultRequestProperty%28java.lang.String,%20java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") key,[String](../../java/lang/String.html "class in java.lang") value)
Deprecated.
The instance specific setRequestProperty method should be used after an appropriate instance of URLConnection is obtained. Invoking this method will have no effect.
void
**[setDefaultUseCaches](../../java/net/URLConnection.html#setDefaultUseCaches%28boolean%29)**(boolean defaultusecaches)
Sets the default value of the useCaches
field to the specified value.
void
**[setDoInput](../../java/net/URLConnection.html#setDoInput%28boolean%29)**(boolean doinput)
Sets the value of the doInput
field for thisURLConnection
to the specified value.
void
**[setDoOutput](../../java/net/URLConnection.html#setDoOutput%28boolean%29)**(boolean dooutput)
Sets the value of the doOutput
field for thisURLConnection
to the specified value.
static void
**[setFileNameMap](../../java/net/URLConnection.html#setFileNameMap%28java.net.FileNameMap%29)**([FileNameMap](../../java/net/FileNameMap.html "interface in java.net") map)
Sets the FileNameMap.
void
**[setIfModifiedSince](../../java/net/URLConnection.html#setIfModifiedSince%28long%29)**(long ifmodifiedsince)
Sets the value of the ifModifiedSince
field of this URLConnection
to the specified value.
void
**[setReadTimeout](../../java/net/URLConnection.html#setReadTimeout%28int%29)**(int timeout)
Sets the read timeout to a specified timeout, in milliseconds.
void
**[setRequestProperty](../../java/net/URLConnection.html#setRequestProperty%28java.lang.String,%20java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") key,[String](../../java/lang/String.html "class in java.lang") value)
Sets the general request property.
void
**[setUseCaches](../../java/net/URLConnection.html#setUseCaches%28boolean%29)**(boolean usecaches)
Sets the value of the useCaches
field of thisURLConnection
to the specified value.
[String](../../java/lang/String.html "class in java.lang")
**[toString](../../java/net/URLConnection.html#toString%28%29)**()
Returns a String
representation of this URL connection.