@Test public void testListAllTbz() throws IOException { File testTgz = TestUtil.getTestFile("tbz/test-archive.tbz"); virtualDir = new VirtualDirTgz(testTgz); String[] allFileArray = virtualDir.listAllFiles(); assertNotNull(allFileArray); List<String> allFiles = Arrays.asList(allFileArray); assertEquals(2, allFiles.size()); assertThat(allFiles, hasItem("dir1/file3.txt")); assertThat(allFiles, hasItem("file1")); }
@Override public String[] listAllFiles() throws IOException { final TarInputStream tis = getTarInputStream(); TarEntry entry; List<String> entryNames = new ArrayList<>(); while ((entry = tis.getNextEntry()) != null) { if (!entry.isDirectory()) { entryNames.add(entry.getName()); } } return entryNames.toArray(new String[entryNames.size()]); }
VirtualDirTgz extends VirtualDir { @Override public String[] listAllFiles() throws IOException { final TarInputStream tis = getTarInputStream(); TarEntry entry; List<String> entryNames = new ArrayList<>(); while ((entry = tis.getNextEntry()) != null) { if (!entry.isDirectory()) { entryNames.add(entry.getName()); } } return entryNames.toArray(new String[entryNames.size()]); } }
VirtualDirTgz extends VirtualDir { @Override public String[] listAllFiles() throws IOException { final TarInputStream tis = getTarInputStream(); TarEntry entry; List<String> entryNames = new ArrayList<>(); while ((entry = tis.getNextEntry()) != null) { if (!entry.isDirectory()) { entryNames.add(entry.getName()); } } return entryNames.toArray(new String[entryNames.size()]); } VirtualDirTgz(File tgz); }
VirtualDirTgz extends VirtualDir { @Override public String[] listAllFiles() throws IOException { final TarInputStream tis = getTarInputStream(); TarEntry entry; List<String> entryNames = new ArrayList<>(); while ((entry = tis.getNextEntry()) != null) { if (!entry.isDirectory()) { entryNames.add(entry.getName()); } } return entryNames.toArray(new String[entryNames.size()]); } VirtualDirTgz(File tgz); @Override String getBasePath(); @Override InputStream getInputStream(String path); @Override File getFile(String path); @Override String[] list(String path); @Override String[] listAllFiles(); @Override void close(); @Override boolean isCompressed(); @Override boolean isArchive(); @Override void finalize(); @Override File getTempDir(); }
VirtualDirTgz extends VirtualDir { @Override public String[] listAllFiles() throws IOException { final TarInputStream tis = getTarInputStream(); TarEntry entry; List<String> entryNames = new ArrayList<>(); while ((entry = tis.getNextEntry()) != null) { if (!entry.isDirectory()) { entryNames.add(entry.getName()); } } return entryNames.toArray(new String[entryNames.size()]); } VirtualDirTgz(File tgz); @Override String getBasePath(); @Override InputStream getInputStream(String path); @Override File getFile(String path); @Override String[] list(String path); @Override String[] listAllFiles(); @Override void close(); @Override boolean isCompressed(); @Override boolean isArchive(); @Override void finalize(); @Override File getTempDir();  }