Пример #1
0
 private ZipEntry entry(TPath path) {
   String pathString = path.toPathString();
   if (pathString.startsWith("/")) {
     pathString = pathString.substring(1);
   }
   return file.getEntry(pathString);
 }
Пример #2
0
 public void close() throws TIoException {
   try {
     file.close();
   } catch (IOException e) {
     throw new TIoException(TPath.parse("/"), "Cannot close jar file", e);
   }
 }
Пример #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);
   }
 }
Пример #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);
 }
Пример #5
0
 public int hashCode(TPath path) {
   return path.hashCode();
 }
Пример #6
0
 public boolean equals(TPath path1, TPath path2) {
   return path1.equals(path2);
 }
Пример #7
0
 public int compare(TPath path1, TPath path2) {
   return path1.compareTo(path2);
 }
Пример #8
0
 public String pathString(TPath path) {
   StringBuffer buffer = new StringBuffer(file.getName());
   buffer.append("[").append(path.toPathString()).append("]");
   return buffer.toString();
 }