Example usage for Java java.net URLConnection fields, constructors, methods, implement or subclass
The text is from its open source code.
URLConnection(URL url) Constructs a URL connection to the specified URL. |
void | addRequestProperty(String key, String value) Adds a general request property specified by a key-value pair. |
void | connect() Opens a communications link to the resource referenced by this URL, if such a connection has not already been established. |
boolean | getAllowUserInteraction() Returns the value of the allowUserInteraction field for this object. |
Class> | getClass() Returns the runtime class of this Object . |
int | getConnectTimeout() Returns setting for connect timeout. |
Object | getContent() Retrieves the contents of this URL connection. |
String | getContentEncoding() Returns the value of the content-encoding header field. |
int | getContentLength() Returns the value of the content-length header field. |
long | getContentLengthLong() Returns the value of the content-length header field as a long. |
String | getContentType() Returns the value of the content-type header field. |
long | getDate() Returns the value of the date header field. |
boolean | getDefaultUseCaches() Returns the default value of a URLConnection 's useCaches flag. |
boolean | getDoInput() Returns the value of this URLConnection 's doInput flag. |
boolean | getDoOutput() Returns the value of this URLConnection 's doOutput flag. |
long | getExpiration() Returns the value of the expires header field. |
FileNameMap | getFileNameMap() Loads filename map (a mimetable) from a data file. |
String | getHeaderField(String name) Returns the value of the named header field. |
String | getHeaderField(int n) Returns the value for the n th header field. |
long | getHeaderFieldDate(String name, long Default) Returns the value of the named field parsed as date. |
int | getHeaderFieldInt(String name, int Default) Returns the value of the named field parsed as a number. |
String | getHeaderFieldKey(int n) Returns the key for the n th header field. |
long | getHeaderFieldLong(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. |
long | getIfModifiedSince() Returns the value of this object's ifModifiedSince field. |
InputStream | getInputStream() Returns an input stream that reads from this open connection. |
long | getLastModified() Returns the value of the last-modified header field. |
OutputStream | getOutputStream() Returns an output stream that writes to this connection. |
Permission | getPermission() Returns a permission object representing the permission necessary to make the connection represented by this object. |
int | getReadTimeout() Returns setting for read timeout. |
Map | getRequestProperties() Returns an unmodifiable Map of general request properties for this connection. |
String | getRequestProperty(String key) Returns the value of the named general request property for this connection. |
URL | getURL() Returns the value of this URLConnection 's URL field. |
boolean | getUseCaches() Returns the value of this URLConnection 's useCaches field. |
String | guessContentTypeFromName(String fname) Tries to determine the content type of an object, based on the specified "file" component of a URL. |
String | guessContentTypeFromStream(InputStream is) Tries to determine the type of an input stream based on the characters at the beginning of the input stream. |
void | setAllowUserInteraction(boolean allowuserinteraction) Set the value of the allowUserInteraction field of this URLConnection . |
void | setConnectTimeout(int timeout) Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this URLConnection. |
void | setDefaultAllowUserInteraction(boolean defaultallowuserinteraction) Sets the default value of the allowUserInteraction field for all future URLConnection objects to the specified value. |
void | setDefaultUseCaches(boolean defaultusecaches) Sets the default value of the useCaches field to the specified value. |
void | setDoInput(boolean doinput) Sets the value of the doInput field for this URLConnection to the specified value. |
void | setDoOutput(boolean dooutput) Sets the value of the doOutput field for this URLConnection to the specified value. |
void | setIfModifiedSince(long ifmodifiedsince) Sets the value of the ifModifiedSince field of this URLConnection to the specified value. |
void | setReadTimeout(int timeout) Sets the read timeout to a specified timeout, in milliseconds. |
void | setRequestProperty(String key, String value) Sets the general request property. |
void | setUseCaches(boolean usecaches) Sets the value of the useCaches field of this URLConnection to the specified value. |
String | toString() Returns a String representation of this URL connection. |