Beispiel #1
0
 private ZipEntry entry(TPath path) {
   String pathString = path.toPathString();
   if (pathString.startsWith("/")) {
     pathString = pathString.substring(1);
   }
   return file.getEntry(pathString);
 }
Beispiel #2
0
 public void close() throws TIoException {
   try {
     file.close();
   } catch (IOException e) {
     throw new TIoException(TPath.parse("/"), "Cannot close jar file", e);
   }
 }
Beispiel #3
0
 public URI toUri(TPath path) {
   try {
     return new URI("jar:" + jarFile.toURI().toString() + "!" + path.toPathString());
   } catch (URISyntaxException e) {
     throw new Error(e.getMessage(), e);
   }
 }
Beispiel #4
0
 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);
 }
Beispiel #5
0
 public int hashCode(TPath path) {
   return path.hashCode();
 }
Beispiel #6
0
 public boolean equals(TPath path1, TPath path2) {
   return path1.equals(path2);
 }
Beispiel #7
0
 public int compare(TPath path1, TPath path2) {
   return path1.compareTo(path2);
 }
Beispiel #8
0
 public String pathString(TPath path) {
   StringBuffer buffer = new StringBuffer(file.getName());
   buffer.append("[").append(path.toPathString()).append("]");
   return buffer.toString();
 }