ArchiveFileUtils { public static URI toZipUri(URI parent, String zipEntry) { return toUri(parent, zipEntry, ImageType.ZIP); } private  ArchiveFileUtils(); static URI toZipUri(URI parent, String zipEntry); static URI toIsoImageUri(URI parent, String imageEntry); static URI toRarUri(URI parent, String rarEntry); static URI toTarUri(URI parent, String tarEntry); static URI toSevenZUri(URI parent, String sevenZipEntry); static URI toFatImageUri(URI parent, String fatEntry); static URI toWebArchiveUri(String archiveType, URI parent, String warcEntry); static Path writeEntryToTemp(final Path tempDir, final ByteBuffer buffer,
                                        final ReadableByteChannel channel); static Path writeFsFileToTemp(final FsDirectoryEntry fsFile, final Path tempDir); static Path writeEntryToTemp(final Path tempDir, final byte[] buffer,
                                        final InputStream in); static URI toGZipUri(URI parent); static URI toBZipUri(URI parent); static URI toReplayUri(URI requestUri); static List<String> getAncestorPaths(String path); static int copyToBuffer(final WindowReader reader, final long position,
                                   final byte[] buffer, final int offset, final int length); static int copyToBuffer(final WindowReader reader, final long position,
                                   final ByteBuffer buffer);  }
@Test public void testBuildZipUri() { URI parent = URI.create("file:/C:/anyhost/dir/my%20zip.zip"); String entryName = "my\\zip entry"; assertEquals("zip:file:/C:/anyhost/dir/my%20zip.zip!/my/zip%20entry", ArchiveFileUtils.toZipUri(parent, entryName).toString()); }
@Test public void testBuildNestedZipUri() { URI parent = URI.create("zip:file:/C:/anyhost/dir/my%20zip.zip!/zip1"); String entryName = "my\\zip entry"; assertEquals("zip:zip:file:/C:/anyhost/dir/my%20zip.zip!/zip1!/my/zip%20entry", ArchiveFileUtils.toZipUri(parent, entryName).toString()); }