Java java.net URLConnection fields, constructors, methods, implement or subclass

Example usage for Java java.net URLConnection fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.net URLConnection.

The text is from its open source code.

Subclass

java.net.URLConnection has subclasses.
Click this link to see all its subclasses.

Constructor

URLConnection(URL url)
Constructs a URL connection to the specified URL.

Method

voidaddRequestProperty(String key, String value)
Adds a general request property specified by a key-value pair.
voidconnect()
Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.
booleangetAllowUserInteraction()
Returns the value of the allowUserInteraction field for this object.
ClassgetClass()
Returns the runtime class of this Object .
intgetConnectTimeout()
Returns setting for connect timeout.
ObjectgetContent()
Retrieves the contents of this URL connection.
StringgetContentEncoding()
Returns the value of the content-encoding header field.
intgetContentLength()
Returns the value of the content-length header field.
longgetContentLengthLong()
Returns the value of the content-length header field as a long.
StringgetContentType()
Returns the value of the content-type header field.
longgetDate()
Returns the value of the date header field.
booleangetDefaultUseCaches()
Returns the default value of a URLConnection 's useCaches flag.
booleangetDoInput()
Returns the value of this URLConnection 's doInput flag.
booleangetDoOutput()
Returns the value of this URLConnection 's doOutput flag.
longgetExpiration()
Returns the value of the expires header field.
FileNameMapgetFileNameMap()
Loads filename map (a mimetable) from a data file.
StringgetHeaderField(String name)
Returns the value of the named header field.
StringgetHeaderField(int n)
Returns the value for the n th header field.
longgetHeaderFieldDate(String name, long Default)
Returns the value of the named field parsed as date.
intgetHeaderFieldInt(String name, int Default)
Returns the value of the named field parsed as a number.
StringgetHeaderFieldKey(int n)
Returns the key for the n th header field.
longgetHeaderFieldLong(String name, long Default)
Returns the value of the named field parsed as a number.
Map>getHeaderFields()
Returns an unmodifiable Map of the header fields.
longgetIfModifiedSince()
Returns the value of this object's ifModifiedSince field.
InputStreamgetInputStream()
Returns an input stream that reads from this open connection.
longgetLastModified()
Returns the value of the last-modified header field.
OutputStreamgetOutputStream()
Returns an output stream that writes to this connection.
PermissiongetPermission()
Returns a permission object representing the permission necessary to make the connection represented by this object.
intgetReadTimeout()
Returns setting for read timeout.
Map>getRequestProperties()
Returns an unmodifiable Map of general request properties for this connection.
StringgetRequestProperty(String key)
Returns the value of the named general request property for this connection.
URLgetURL()
Returns the value of this URLConnection 's URL field.
booleangetUseCaches()
Returns the value of this URLConnection 's useCaches field.
StringguessContentTypeFromName(String fname)
Tries to determine the content type of an object, based on the specified "file" component of a URL.
StringguessContentTypeFromStream(InputStream is)
Tries to determine the type of an input stream based on the characters at the beginning of the input stream.
voidsetAllowUserInteraction(boolean allowuserinteraction)
Set the value of the allowUserInteraction field of this URLConnection .
voidsetConnectTimeout(int timeout)
Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this URLConnection.
voidsetDefaultAllowUserInteraction(boolean defaultallowuserinteraction)
Sets the default value of the allowUserInteraction field for all future URLConnection objects to the specified value.
voidsetDefaultUseCaches(boolean defaultusecaches)
Sets the default value of the useCaches field to the specified value.
voidsetDoInput(boolean doinput)
Sets the value of the doInput field for this URLConnection to the specified value.
voidsetDoOutput(boolean dooutput)
Sets the value of the doOutput field for this URLConnection to the specified value.
voidsetIfModifiedSince(long ifmodifiedsince)
Sets the value of the ifModifiedSince field of this URLConnection to the specified value.
voidsetReadTimeout(int timeout)
Sets the read timeout to a specified timeout, in milliseconds.
voidsetRequestProperty(String key, String value)
Sets the general request property.
voidsetUseCaches(boolean usecaches)
Sets the value of the useCaches field of this URLConnection to the specified value.
StringtoString()
Returns a String representation of this URL connection.