/** * This implementation returns a File reference for the underlying class path * resource, provided that it refers to a file in the file system. * @see bingo.lang.io.Resources.util.ResourceUtils#getFile(java.net.URL, String) */ @Override public File getFile() throws NestedIOException { try { URL url = getURL(); if (url.getProtocol().startsWith(Urls.PROTOCOL_VFS)) { return VfsResourceDelegate.getResource(url).getFile(); } return Files.fromUrl(url, getDescription()); } catch (IOException e) { throw Exceptions.wrap(e); } }
/** * This implementation determines the underlying File * (or jar file, in case of a resource in a jar/zip). */ @Override protected File getFileForLastModifiedCheck() throws IOException { URL url = getURL(); if (Urls.isJarUrl(url)) { URL actualUrl = Urls.getJarFileURL(url); if (actualUrl.getProtocol().startsWith(Urls.PROTOCOL_VFS)) { return VfsResourceDelegate.getResource(actualUrl).getFile(); } return Files.fromUrl(actualUrl, "Jar URL"); } else { return getFile(); } }