# Class URL

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

public class URL extends Object
This class provides a similar API to `URL` making it almost into a "drop in" replacement. It is placed in a different package because it is incompatible to `URL` by definition. It is useful in getting some simple code to work without too many changes

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `URL.HttpURLConnection`
  `class`
  `URL.URLConnection`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `URL(String url)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `String`
  `getAuthority()`
  `int`
  `getDefaultPort()`
  `String`
  `getFile()`
  `String`
  `getHost()`
  `String`
  `getPath()`
  `int`
  `getPort()`
  `String`
  `getProtocol()`
  `String`
  `getQuery()`
  `String`
  `getUserInfo()`
  `int`
  `hashCode()`
  `URL.URLConnection`
  `openConnection()`
  `final InputStream`
  `openStream()`
  `boolean`
  `sameFile(URL u)`
  `String`
  `toExternalForm()`
  `String`
  `toString()`
  `URI`
  `toURI()`

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### URL

    public URL(String url) throws URISyntaxException
    Throws:
      `URISyntaxException`

- ## Method Details

  - ### getQuery

    public String getQuery()

  - ### getPath

    public String getPath()

  - ### getUserInfo

    public String getUserInfo()

  - ### getAuthority

    public String getAuthority()

  - ### getPort

    public int getPort()

  - ### getDefaultPort

    public int getDefaultPort()

  - ### getProtocol

    public String getProtocol()

  - ### getHost

    public String getHost()

  - ### getFile

    public String getFile()

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### sameFile

    public boolean sameFile(URL u)

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### toExternalForm

    public String toExternalForm()

  - ### toURI

    public URI toURI() throws URISyntaxException
    Throws:
      `URISyntaxException`

  - ### openConnection

    public URL.URLConnection openConnection() throws IOException
    Throws:
      `IOException`

  - ### openStream

    public final InputStream openStream() throws IOException
    Throws:
      `IOException`