# Class URL

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

public class URL extends java.lang.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(java.lang.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 java.io.InputStream`
  `openStream()`
  `boolean`
  `sameFile(URL u)`
  `String`
  `toExternalForm()`
  `String`
  `toString()`
  `java.net.URI`
  `toURI()`

  ### Methods inherited from class java.lang.Object

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

- ## Constructor Details

  - ### URL

    public URL(String url) throws java.net.URISyntaxException
    Throws:
      `java.net.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(java.lang.Object o)
    Overrides:
      `equals` in class `java.lang.Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `java.lang.Object`

  - ### sameFile

    public boolean sameFile(URL u)

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `java.lang.Object`

  - ### toExternalForm

    public String toExternalForm()

  - ### toURI

    public java.net.URI toURI() throws java.net.URISyntaxException
    Throws:
      `java.net.URISyntaxException`

  - ### openConnection

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

  - ### openStream

    public final java.io.InputStream openStream() throws java.io.IOException
    Throws:
      `java.io.IOException`