private ZipEntry entry(TPath path) { String pathString = path.toPathString(); if (pathString.startsWith("/")) { pathString = pathString.substring(1); } return file.getEntry(pathString); }
public void close() throws TIoException { try { file.close(); } catch (IOException e) { throw new TIoException(TPath.parse("/"), "Cannot close jar file", e); } }
public URI toUri(TPath path) { try { return new URI("jar:" + jarFile.toURI().toString() + "!" + path.toPathString()); } catch (URISyntaxException e) { throw new Error(e.getMessage(), e); } }
public static FileSystem readOnlyZipFileSystem(File jarFile) throws TIoException { ZipFileSystem zipFileSystem; try { zipFileSystem = new ZipFileSystem(jarFile); } catch (IOException e) { throw new TIoException( TPath.parse("/"), "Error opening zip file <" + jarFile.getAbsolutePath() + ">", e); } return ControlledFileSystem.readOnlyFileSystem(zipFileSystem); }
public int hashCode(TPath path) { return path.hashCode(); }
public boolean equals(TPath path1, TPath path2) { return path1.equals(path2); }
public int compare(TPath path1, TPath path2) { return path1.compareTo(path2); }
public String pathString(TPath path) { StringBuffer buffer = new StringBuffer(file.getName()); buffer.append("[").append(path.toPathString()).append("]"); return buffer.toString(); }