URI

In this chapter you will learn:

  1. What is URI class

What is URI class

The URI class encapsulates a Uniform Resource Identifier (URI). URIs are similar to URLs.

URLs constitute a subset of URIs. A URI represents a standard way to identify a resource. A URL also describes how to access the resource.

import java.net.URI;
import java.net.URISyntaxException;
//from   j  a va 2s.  c  om
public class Main {
  public static void main(String[] args) throws NullPointerException, URISyntaxException {
    URI uri = new URI("http://www.example.org");
    System.out.println("URI      : " + uri);
    System.out.println("Raw Authority : " + uri.getRawAuthority());
    System.out.println("Raw Fragment : " + uri.getRawFragment());
    System.out.println("Fragment : " + uri.getFragment());
    System.out.println("Authority : " + uri.getAuthority());
    System.out.println("Authority : " + uri.getRawPath());
    System.out.println("RawQuery : " + uri.getRawQuery());
    System.out.println("RawSchemeSpecificPart : " + uri.getRawSchemeSpecificPart());
    System.out.println("RawUserInfo : " + uri.getRawUserInfo());

  }
}

Next chapter...

What you will learn in the next chapter:

  1. How to do URI Normalization
Home » Java Tutorial » URL URI
URL
URL Creation
URL for jar file
URL Components
Convert file path to URL
URL Relative
URL Protocol
Read from URL
Compare URL
URLConnection
HTTP Header
URLConnection Post
Cookie
URLConnection Read
HttpURLConnection
HttpURLConnection Properties
HttpURLConnection proxy
HttpURLConnection Authenticator
HTTPS
JarURLConnection
Encode a URL
Decode a URL
URI
URI Normalization
URI Resolution
URI Relativization
Convert URI to URL
IP Address
IP Ping
NetworkInterface