URI
In this chapter you will learn:
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:
Home » Java Tutorial » URL URI