• Field Summary

    Fields

    protected boolean

    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.

    protected boolean

    If false, this connection object has not created a communications link to the specified URL.

    protected boolean

    This variable is set by the setDoInput method.

    protected boolean

    This variable is set by the setDoOutput method.

    protected long

    Some protocols support skipping the fetching of the object unless the object has been modified more recently than a certain time.

    protected URL

    The URL represents the remote object on the World Wide Web to which this connection is opened.

    protected boolean

    If true, the protocol is allowed to use caching whenever it can.

  • Constructor Summary

    Constructors

    protected

    Constructs a URL connection to the specified URL.

  • Method Summary

    void

    Adds a general request property specified by a key-value pair.

    abstract void

    connect()

    Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.

    boolean

    Returns the value of the allowUserInteraction field for this object.

    int

    Returns setting for connect timeout.

    Retrieves the contents of this URL connection.

    Retrieves the contents of this URL connection.

    Returns the value of the content-encoding header field.

    int

    Returns the value of the content-length header field.

    long

    Returns the value of the content-length header field as a long.

    Returns the value of the content-type header field.

    long

    getDate()

    Returns the value of the date header field.

    static boolean

    Returns the default value of the allowUserInteraction field.

    boolean

    Returns the default value of a URLConnection's useCaches flag.

    static boolean

    Returns the default value of the useCaches flag for the given protocol.

    boolean

    Returns the value of this URLConnection's doInput flag.

    boolean

    Returns the value of this URLConnection's doOutput flag.

    long

    Returns the value of the expires header field.

    Loads filename map (a mimetable) from a data file.

    getHeaderField(int n)

    Returns the value for the nth header field.

    Returns the value of the named header field.

    long

    getHeaderFieldDate(String name, long defaultValue)

    Returns the value of the named field parsed as date.

    int

    getHeaderFieldInt(String name, int defaultValue)

    Returns the value of the named field parsed as a number.

    getHeaderFieldKey(int n)

    Returns the key for the nth header field.

    long

    getHeaderFieldLong(String name, long defaultValue)

    Returns the value of the named field parsed as a number.

    Returns an unmodifiable Map of the header fields.

    long

    Returns the value of this object's ifModifiedSince field.

    Returns an input stream that reads from this open connection.

    long

    Returns the value of the last-modified header field.

    Returns an output stream that writes to this connection.

    Returns a permission object representing the permission necessary to make the connection represented by this object.

    int

    Returns setting for read timeout. 0 return implies that the option is disabled (i.e., timeout of infinity).

    Returns an unmodifiable Map of general request properties for this connection.

    Returns the value of the named general request property for this connection.

    getURL()

    Returns the value of this URLConnection's URL field.

    boolean

    Returns the value of this URLConnection's useCaches field.

    Tries to determine the content type of an object, based on the specified "file" component of a URL.

    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.

    static void

    Sets the ContentHandlerFactory of an application.

    static void

    setDefaultAllowUserInteraction(boolean defaultallowuserinteraction)

    Sets the default value of the allowUserInteraction field for all future URLConnection objects to the specified value.

    static void

    void

    setDefaultUseCaches(boolean defaultusecaches)

    Sets the default value of the useCaches field to the specified value.

    static void

    setDefaultUseCaches(String protocol, boolean defaultVal)

    Sets the default value of the useCaches field for the named protocol to the given 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.

    static void

    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

    Sets the general request property.

    void

    setUseCaches(boolean usecaches)

    Sets the value of the useCaches field of this URLConnection to the specified value.

    toString()

    Returns a String representation of this URL connection.

  • Field Details

    • url

    • doInput

    • doOutput

    • allowUserInteraction

    • useCaches

    • ifModifiedSince

    • connected

  • Constructor Details

    • URLConnection

  • Method Details

    • getFileNameMap

    • setFileNameMap

    • connect

    • setConnectTimeout

    • getConnectTimeout

    • setReadTimeout

    • getReadTimeout

    • getURL

    • getContentLength

    • getContentLengthLong

    • getContentType

    • getContentEncoding

    • getExpiration

    • getDate

    • getLastModified

    • getContent

    • getContent

    • getPermission

    • getInputStream

    • getOutputStream

    • toString

    • setDoInput

    • getDoInput

    • setDoOutput

    • getDoOutput

    • setAllowUserInteraction

    • getAllowUserInteraction

    • setDefaultAllowUserInteraction

    • getDefaultAllowUserInteraction

    • setUseCaches

    • getUseCaches

    • setIfModifiedSince

    • getIfModifiedSince

    • getDefaultUseCaches

    • setDefaultUseCaches

    • setDefaultUseCaches

    • getDefaultUseCaches

    • setRequestProperty

    • addRequestProperty

    • getRequestProperty

    • getRequestProperties

    • setDefaultRequestProperty

    • getDefaultRequestProperty

    • setContentHandlerFactory

    • guessContentTypeFromName

    • guessContentTypeFromStream