Java/JDK 6/Internationalized Resource Identifiers

Материал из Java эксперт
Перейти к: навигация, поиск

Internationalized Resource Identifiers

 
import java.net.URI;
import java.net.URISyntaxException;
public class IRIDemo {
  public static void main(String[] args) throws NullPointerException, URISyntaxException {
    URI uri = new URI("http://r%C3%A9sum%C3%A9.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());
  }
}
/*
URI      : http://r%C3%A9sum%C3%A9.example.org
Raw Authority : r%C3%A9sum%C3%A9.example.org
Raw Fragment : null
Fragment : null
Authority : résumé.example.org
Authority : 
RawQuery : null
RawSchemeSpecificPart : //r%C3%A9sum%C3%A9.example.org
RawUserInfo : null
*/