# Class URL.URLConnection

java.lang.Object
com.codename1.io.URL.URLConnection

Direct Known Subclasses:
  `URL.HttpURLConnection`

Enclosing class:
  `URL`

public abstract class URL.URLConnection extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `URLConnection()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract void`
  `connect()`
  `int`
  `getConnectTimeout()`
  `abstract int`
  `getContentLength()`
  `long`
  `getContentLengthLong()`
  `abstract String`
  `getContentType()`
  `boolean`
  `getDoInput()`
  `boolean`
  `getDoOutput()`
  `abstract String`
  `getHeaderField(String s)`
  `abstract Map<String, List<String>>`
  `getHeaderFields()`
  `abstract InputStream`
  `getInputStream()`
  `abstract OutputStream`
  `getOutputStream()`
  `int`
  `getReadTimeout()`
  `URL`
  `getURL()`
  `void`
  `setConnectTimeout(int connectTimeout)`
  `void`
  `setDoInput(boolean i)`
  `void`
  `setDoOutput(boolean i)`
  `void`
  `setReadTimeout(int readTimeout)`
  `void`
  `setRequestProperty(String key, String value)`
  Sets the request property, replacing existing property with same key, if it already exists.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `final Class`
  `getClass()`
  Returns the runtime class of an object.
  `int`
  `hashCode()`
  Returns a hash code value for the object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes current thread to wait until another thread invokes the method or the method for this object.
  `final void`
  `wait(long timeout)`
  Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
  `final void`
  `wait(long timeout, int nanos)`
  Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

- ## Constructor Details

  - ### URLConnection

    public URLConnection()

- ## Method Details

  - ### connect

    public abstract void connect() throws IOException
    Throws:
      `IOException`

  - ### getConnectTimeout

    public int getConnectTimeout()

  - ### setConnectTimeout

    public void setConnectTimeout(int connectTimeout)

  - ### getReadTimeout

    public int getReadTimeout()

  - ### setReadTimeout

    public void setReadTimeout(int readTimeout)

  - ### getURL

    public URL getURL()

  - ### getContentLength

    public abstract int getContentLength()

  - ### getContentLengthLong

    public long getContentLengthLong()

  - ### getContentType

    public abstract String getContentType()

  - ### getHeaderField

    public abstract String getHeaderField(String s)

  - ### getHeaderFields

    public abstract Map<String, List<String>> getHeaderFields()

  - ### getInputStream

    public abstract InputStream getInputStream() throws IOException
    Throws:
      `IOException`

  - ### getOutputStream

    public abstract OutputStream getOutputStream() throws IOException
    Throws:
      `IOException`

  - ### setRequestProperty

    public void setRequestProperty(String key, String value)

    Sets the request property, replacing existing property with same key, if it already exists.

    ###### Parameters

    - `key`: The key of the request property.

    - `value`: The value of the request property.

    ###### Since

    7.0

  - ### getDoInput

    public boolean getDoInput()

  - ### setDoInput

    public void setDoInput(boolean i)

  - ### getDoOutput

    public boolean getDoOutput()

  - ### setDoOutput

    public void setDoOutput(boolean i)