VirtualDirTgz extends VirtualDir { static boolean isTgz(String filename) { String lcName = filename.toLowerCase(); return lcName.endsWith(".tar.gz") || lcName.endsWith(".tgz"); } VirtualDirTgz(File tgz); @Override String getBasePath(); @Override File getBaseFile(); @Override InputStream getInputStream(String path); @Override File getFile(String path); @Override String[] list(String path); @Override boolean exists(String path); @Override String[] listAllFiles(); @Override void close(); @Override boolean isCompressed(); @Override boolean isArchive(); @Override void finalize(); @Override File getTempDir();  }
@Test public void testIsTgz() { assertTrue(VirtualDirTgz.isTgz("test_archive.tar.gz")); assertTrue(VirtualDirTgz.isTgz("test_archive.tgz")); assertFalse(VirtualDirTgz.isTgz("test_archive.tar")); assertFalse(VirtualDirTgz.isTgz("test_archive.exe")); assertFalse(VirtualDirTgz.isTgz("test_archive")); }