Get user information from a URI in Java

Description

The following code shows how to get user information from a URI.

Example


import java.net.URI;
/*w  ww.j  a  v a 2 s. co m*/
public class Main {

  public static void main(String args[]) throws Exception {

    URI u = new URI("http://abc@def/www.java2s.com");
    System.out.println("The user info is " + u.getUserInfo());    
  }

}

The code above generates the following result.





















Home »
  Java Tutorial »
    Network »




NetworkInterface
URI
URL
HTTP
HTTP Read
IP
Socket
UDP
URL Encode