IoUtils { public static Path extractPathFromURI(String uriStr) { URI uri = URI.create(uriStr); return extractPath(uri); } private  IoUtils(); static PrintWriter openPrintWriter(File file); static PrintWriter openPrintWriter(File file, boolean append); static PrintWriter openPrintWriter(File file, String encoding, boolean append); static BufferedWriter openBufferedWriter(File file); static BufferedWriter openBufferedWriter(File file, String encoding, boolean append); static BufferedReader openReader(File file); static BufferedReader openReader(File file, String encoding); static void write(Properties props, File outFile); static Properties readProperties(File inFile); static Properties readProperties(File inFile, String encoding); static void writeProperties(Properties props, File outFile); static Path addExtension(Path srcPath, String newExt); static Path extractPathFromURI(String uriStr); static Path extractPath(URI uri);  }
@Test public void testExtractPathFromURI() { assertEquals(Paths.get("1376"), IoUtils.extractPathFromURI("1376")); assertEquals(Paths.get("folder/doc1.txt"), IoUtils.extractPathFromURI("folder/doc1.txt")); assertEquals(Paths.get("/folder/doc1.txt"), IoUtils.extractPathFromURI("http: }