List of usage examples for java.net URI URI
public URI(String str) throws URISyntaxException
From source file:Main.java
public static void main(String[] args) throws Exception { Path path = Paths.get(new URI("C:/home/./music/users.txt")); System.out.println(path);//ww w.j a va2 s . c om System.out.println("Normalized: " + path.normalize()); }
From source file:Main.java
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()); }
From source file:IRIDemo.java
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()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { try {//from w ww. j a v a 2 s .co m URL url = new URI("").toURL(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } }
From source file:Test.java
public static void main(String[] args) throws Exception { Path path = Paths.get(new URI("file:///C:/home/docs/users.txt")); File file = new File("C:\\home\\docs\\users.txt"); Path toPath = file.toPath();/*from ww w . j a v a 2s. c o m*/ System.out.println(toPath.equals(path)); }
From source file:Main.java
public static void main(String[] args) throws Exception { Path p = Paths.get(new URI("file:///tmp.txt")); System.out.println(p);//from www .j ava 2 s. c o m Files.delete(p); }
From source file:Main.java
public static void main(String... args) throws Exception { String url = "http://www.java2s.com/Tutorials/Java/Algorithms_How_to/index.htm"; URI u = new URI(url); for (String ext : new String[] { ".png", ".pdf", ".jpg", ".html", "htm" }) { if (u.getPath().endsWith(ext)) { System.out.println("Yeap"); break; }/*from w w w . j a va 2 s. c o m*/ } }
From source file:Main.java
public static void main(String[] argv) throws Exception { URI uri = null;//from w ww . j av a 2 s . c om URL url = null; // Create a URI uri = new URI("file://D:/1.4/Ex1.java"); }
From source file:Main.java
public static void main(String[] args) { File aFile;/*ww w .j a v a 2s .co m*/ try { aFile = new File(new URI("file:///c:/a.bat")); System.out.println(aFile.getName());//false } catch (URISyntaxException e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { URI uri = null;/*from ww w . j a v a2s. c om*/ URL url = null; // Create a URI uri = new URI("file://D:/1.4/Ex1.java"); url = uri.toURL(); uri = new URI(url.toString()); }