ResourceUtils { public static File getUrlAsFile(URL aUrl, boolean aCache) throws IOException { return getUrlAsFile(aUrl, aCache, false); }  static File getClasspathAsFolder(String aClasspathBase, boolean aCache); static File getUrlAsFile(URL aUrl, boolean aCache); static synchronized File getUrlAsFile(URL aUrl, boolean aCache, boolean aForceTemp); static synchronized File getUrlAsExecutable(URL aUrl, boolean aCache); @Deprecated static InputStream resolveCompressedInputStream(InputStream is, String filename); static URL resolveLocation(String aLocation); static URL resolveLocation(String aLocation, UimaContext aContext); static URL resolveLocation(String aLocation, Object aCaller, UimaContext aContext); static URL resolveLocation(String aLocation, ClassLoader aClassLoader,
            UimaContext aContext);  }
@Test public void testGetUrlAsFile() throws Exception { URL url = new URL( "jar:file:src/test/resources/testfiles.zip!/testfiles/FileSetCollectionReaderBase.class"); System.out.println("Original: " + url); File file = ResourceUtils.getUrlAsFile(url, false); System.out.println("As file: " + file.getPath()); assertTrue(file.getName().endsWith(".class")); }
@Test public void testWithSpace() throws Exception { File dir = workspace.newFolder("this is a test"); File file = new File(dir, "this is a file name.extension with spaces"); System.out.println("Original: " + file); System.out.println("Original (URL): " + file.toURI().toURL()); File asFile = ResourceUtils.getUrlAsFile(file.toURI().toURL(), false); System.out.println("As file: " + asFile.getPath()); assertEquals("this is a file name", FilenameUtils.getBaseName(asFile.getPath())); assertEquals("extension with spaces", FilenameUtils.getExtension(asFile.getPath())); }