URLConnection (Java Platform SE 8 ) (original) (raw)
Modifier and Type
Method
Description
void
[addRequestProperty](../../java/net/URLConnection.html#addRequestProperty-java.lang.String-java.lang.String-)([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--)()
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--)()
Returns the value of the allowUserInteraction
field for this object.
int
[getConnectTimeout](../../java/net/URLConnection.html#getConnectTimeout--)()
Returns setting for connect timeout.
[Object](../../java/lang/Object.html "class in java.lang")
[getContent](../../java/net/URLConnection.html#getContent--)()
Retrieves the contents of this URL connection.
[Object](../../java/lang/Object.html "class in java.lang")
[getContent](../../java/net/URLConnection.html#getContent-java.lang.Class:A-)([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--)()
Returns the value of the content-encoding
header field.
int
[getContentLength](../../java/net/URLConnection.html#getContentLength--)()
Returns the value of the content-length
header field.
long
[getContentLengthLong](../../java/net/URLConnection.html#getContentLengthLong--)()
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--)()
Returns the value of the content-type
header field.
long
[getDate](../../java/net/URLConnection.html#getDate--)()
Returns the value of the date
header field.
static boolean
[getDefaultAllowUserInteraction](../../java/net/URLConnection.html#getDefaultAllowUserInteraction--)()
Returns the default value of the allowUserInteraction
field.
static [String](../../java/lang/String.html "class in java.lang")
[getDefaultRequestProperty](../../java/net/URLConnection.html#getDefaultRequestProperty-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") key)
boolean
[getDefaultUseCaches](../../java/net/URLConnection.html#getDefaultUseCaches--)()
Returns the default value of a URLConnection
'suseCaches
flag.
boolean
[getDoInput](../../java/net/URLConnection.html#getDoInput--)()
Returns the value of this URLConnection
'sdoInput
flag.
boolean
[getDoOutput](../../java/net/URLConnection.html#getDoOutput--)()
Returns the value of this URLConnection
'sdoOutput
flag.
long
[getExpiration](../../java/net/URLConnection.html#getExpiration--)()
Returns the value of the expires
header field.
static [FileNameMap](../../java/net/FileNameMap.html "interface in java.net")
[getFileNameMap](../../java/net/URLConnection.html#getFileNameMap--)()
Loads filename map (a mimetable) from a data file.
[String](../../java/lang/String.html "class in java.lang")
[getHeaderField](../../java/net/URLConnection.html#getHeaderField-int-)(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-java.lang.String-)([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-java.lang.String-long-)([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-java.lang.String-int-)([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-int-)(int n)
Returns the key for the n
th header field.
long
[getHeaderFieldLong](../../java/net/URLConnection.html#getHeaderFieldLong-java.lang.String-long-)([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--)()
Returns an unmodifiable Map of the header fields.
long
[getIfModifiedSince](../../java/net/URLConnection.html#getIfModifiedSince--)()
Returns the value of this object's ifModifiedSince
field.
[InputStream](../../java/io/InputStream.html "class in java.io")
[getInputStream](../../java/net/URLConnection.html#getInputStream--)()
Returns an input stream that reads from this open connection.
long
[getLastModified](../../java/net/URLConnection.html#getLastModified--)()
Returns the value of the last-modified
header field.
[OutputStream](../../java/io/OutputStream.html "class in java.io")
[getOutputStream](../../java/net/URLConnection.html#getOutputStream--)()
Returns an output stream that writes to this connection.
[Permission](../../java/security/Permission.html "class in java.security")
[getPermission](../../java/net/URLConnection.html#getPermission--)()
Returns a permission object representing the permission necessary to make the connection represented by this object.
int
[getReadTimeout](../../java/net/URLConnection.html#getReadTimeout--)()
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--)()
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-java.lang.String-)([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--)()
Returns the value of this URLConnection
's URL
field.
boolean
[getUseCaches](../../java/net/URLConnection.html#getUseCaches--)()
Returns the value of this URLConnection
'suseCaches
field.
static [String](../../java/lang/String.html "class in java.lang")
[guessContentTypeFromName](../../java/net/URLConnection.html#guessContentTypeFromName-java.lang.String-)([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-java.io.InputStream-)([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-boolean-)(boolean allowuserinteraction)
Set the value of the allowUserInteraction
field of this URLConnection
.
void
[setConnectTimeout](../../java/net/URLConnection.html#setConnectTimeout-int-)(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-java.net.ContentHandlerFactory-)([ContentHandlerFactory](../../java/net/ContentHandlerFactory.html "interface in java.net") fac)
Sets the ContentHandlerFactory
of an application.
static void
[setDefaultAllowUserInteraction](../../java/net/URLConnection.html#setDefaultAllowUserInteraction-boolean-)(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-java.lang.String-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") key,[String](../../java/lang/String.html "class in java.lang") value)
void
[setDefaultUseCaches](../../java/net/URLConnection.html#setDefaultUseCaches-boolean-)(boolean defaultusecaches)
Sets the default value of the useCaches
field to the specified value.
void
[setDoInput](../../java/net/URLConnection.html#setDoInput-boolean-)(boolean doinput)
Sets the value of the doInput
field for thisURLConnection
to the specified value.
void
[setDoOutput](../../java/net/URLConnection.html#setDoOutput-boolean-)(boolean dooutput)
Sets the value of the doOutput
field for thisURLConnection
to the specified value.
static void
[setFileNameMap](../../java/net/URLConnection.html#setFileNameMap-java.net.FileNameMap-)([FileNameMap](../../java/net/FileNameMap.html "interface in java.net") map)
Sets the FileNameMap.
void
[setIfModifiedSince](../../java/net/URLConnection.html#setIfModifiedSince-long-)(long ifmodifiedsince)
Sets the value of the ifModifiedSince
field of this URLConnection
to the specified value.
void
[setReadTimeout](../../java/net/URLConnection.html#setReadTimeout-int-)(int timeout)
Sets the read timeout to a specified timeout, in milliseconds.
void
[setRequestProperty](../../java/net/URLConnection.html#setRequestProperty-java.lang.String-java.lang.String-)([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-boolean-)(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--)()
Returns a String
representation of this URL connection.