URLConnection Members

URLConnection Members

Class Overview | This Package | All Packages

Fields
Name Description
allowUserInteraction If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog.
connected If false, this connection object has not created a communications link to the specified URL.
doInput This variable is set by the setDoInput method.
doOutput This variable is set by the setDoOutput method.
fileNameMap  
ifModifiedSince Some protocols support skipping the fetching of the object unless the object has been modified more recently than a certain time.
url The URL represents the remote object on the World Wide Web to which this connection is opened.
useCaches If true, the protocol is allowed to use caching whenever it can.

Constructors
Name Description
URLConnection(URL) Constructs a URL connection to the specified URL.

Methods
Name Description
connect() Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.
getAllowUserInteraction() Returns the value of the allowUserInteraction field for this object.
getContent() Retrieves the contents of this URL connection.
getContentEncoding() Returns the value of the content-encoding header field.
getContentLength() Returns the value of the content-length header field.
getContentType() Returns the value of the content-type header field.
getDate() Returns the value of the date header field.
getDefaultAllowUserInteraction() Returns the default value of the allowUserInteraction field.
getDefaultRequestProperty(String) Returns the value of the default request property.
getDefaultUseCaches() Returns the default value of a URLConnection's useCaches flag.
getDoInput() Returns the value of this URLConnection's doInput flag.
getDoOutput() Returns the value of this URLConnection's doOutput flag.
getExpiration() Returns the value of the expires header field.
getHeaderField(int) Returns the value for the nth header field.
getHeaderField(String) Returns the name of the specified header field.
getHeaderFieldDate(String, long) Returns the value of the named field parsed as date.
getHeaderFieldInt(String, int) Returns the value of the named field parsed as a number.
getHeaderFieldKey(int) Returns the key for the nth header field.
getIfModifiedSince() Returns the value of this object's ifModifiedSince field.
getInputStream() Returns an input stream that reads from this open connection.
getLastModified() Returns the value of the last-modified header field.
getOutputStream() Returns an output stream that writes to this connection.
getRequestProperty(String) Returns the value of the named general request property for this connection.
getURL() Returns the value of this URLConnection's URL field.
getUseCaches() Returns the value of this URLConnection's useCaches field.
guessContentTypeFromName(String) Tries to determine the content type of an object, based on the specified "file" component of a URL.
guessContentTypeFromStream(InputStream) Tries to determine the type of an input stream based on the characters at the beginning of the input stream.
setAllowUserInteraction(boolean) Set the value of the allowUserInteraction field of this URLConnection.
setContentHandlerFactory(ContentHandlerFactory) Sets the ContentHandlerFactory of an application.
setDefaultAllowUserInteraction(boolean) Sets the default value of the allowUserInteraction field for all future URLConnection objects to the specified value.
setDefaultRequestProperty(String, String) Sets the default value of a general request property.
setDefaultUseCaches(boolean) Sets the default value of the useCaches field to the specified value.
setDoInput(boolean) Sets the value of the doInput field for this URLConnection to the specified value.
setDoOutput(boolean) Sets the value of the doOutput field for this URLConnection to the specified value.
setIfModifiedSince(long) Sets the value of the ifModifiedSince field of this URLConnection to the specified value.
setRequestProperty(String, String) Sets the general request property.
setUseCaches(boolean) Sets the value of the useCaches field of this URLConnection to the specified value.
toString() Returns a String representation of this URL connection.