19 lines
707 B
Java
19 lines
707 B
Java
import java.net.URI;
|
|
import java.nio.file.Paths;
|
|
|
|
public class TestFileUri {
|
|
public static void main(String[] args) throws Exception {
|
|
String uploadPath = "/home/x79/sisvietnamvn_01/sisvietnamvn_main/uploads";
|
|
System.out.println("Using file:/ + uploadPath:");
|
|
try {
|
|
URI uri1 = new URI("file:/" + uploadPath + "/");
|
|
System.out.println(" Host: " + uri1.getHost());
|
|
System.out.println(" Path: " + uri1.getPath());
|
|
} catch(Exception e) { e.printStackTrace(); }
|
|
|
|
System.out.println("\nUsing Paths.get().toUri():");
|
|
URI uri2 = Paths.get(uploadPath).toUri();
|
|
System.out.println(" URI: " + uri2.toString());
|
|
}
|
|
}
|