@Override public ArchiveEntryIterator getEntryIterator() throws IOException { String extension = getCustomExtension() != null ? getCustomExtension() : getExtension(); String name = getName(); if(extension!=null) { // Remove the 'bz2' or 'tbz2' extension from the entry's name switch(extension.toLowerCase()) { case "tbz2": name = name.substring(0, name.length()-4)+"tar"; break; case "bz2": name = name.substring(0, name.length()-4); break; default: } } return new SingleArchiveEntryIterator(new ArchiveEntry("/"+name, false, getDate(), -1, true)); }
@Override public ArchiveEntryIterator getEntryIterator() throws IOException { String extension = getCustomExtension() != null ? getCustomExtension() : getExtension(); String name = getName(); if(extension!=null) { // Remove the 'gz' or 'tgz' extension from the entry's name switch(extension.toLowerCase()) { case "tgz": name = name.substring(0, name.length()-3)+"tar"; break; case "gz": name = name.substring(0, name.length()-3); break; default: } } return new SingleArchiveEntryIterator(new ArchiveEntry("/"+name, false, getDate(), -1, true)); }
/** * Creates and return an {@link ArchiveEntry()} whose attributes are fetched from the given {@link com.github.junrar.rarfile.FileHeader} * * @param header the object that serves to initialize the attributes of the returned ArchiveEntry * @return an ArchiveEntry whose attributes are fetched from the given FileHeader */ private ArchiveEntry createArchiveEntry(FileHeader header) { return new ArchiveEntry( header.getFileNameString().replace('\\', '/'), header.isDirectory(), header.getMTime().getTime(), header.getFullUnpackSize(), true ); }
return new ArchiveEntry(name, false, date, size, true);
return getArchiveEntryFile(new ArchiveEntry(entryPath, false, 0, 0, false), parentFile);
/** * Creates and return an {@link ArchiveEntry()} whose attributes are fetched from the given {@link SevenZipEntry} * * @param entry the object that serves to initialize the attributes of the returned ArchiveEntry * @return an ArchiveEntry whose attributes are fetched from the given SevenZipEntry */ private ArchiveEntry createArchiveEntry(SevenZipEntry entry) { return new ArchiveEntry(entry.getName(), entry.isDirectory(), entry.getTime(), entry.getSize(), true); }
childNode = new DefaultMutableTreeNode(new ArchiveEntry(subPath, true, entry.getDate(), 0, true), true); node.add(childNode); node = childNode;
/** * Creates and return an {@link ArchiveEntry()} whose attributes are fetched from the given * <code>org.apache.tools.tar.TarEntry</code>. * * @param tarEntry the object that serves to initialize the attributes of the returned ArchiveEntry * @return an ArchiveEntry whose attributes are fetched from the given org.apache.tools.tar.TarEntry */ private ArchiveEntry createArchiveEntry(TarEntry tarEntry) { ArchiveEntry entry = new ArchiveEntry(tarEntry.getName(), tarEntry.isDirectory(), tarEntry.getModTime().getTime(), tarEntry.getSize(), true); entry.setPermissions(new SimpleFilePermissions(tarEntry.getMode() & PermissionBits.FULL_PERMISSION_INT)); entry.setOwner(tarEntry.getUserName()); entry.setGroup(tarEntry.getGroupName()); entry.setEntryObject(tarEntry); return entry; }
/** * Creates and return an {@link ArchiveEntry()} whose attributes are fetched from the given {@link com.mucommander.commons.file.archive.zip.provider.ZipEntry}. * It is worth noting that the returned entry has the {@link ArchiveEntry#exists exists} flag set to <code>true</code>. * * @param zipEntry the object that serves to initialize the attributes of the returned ArchiveEntry * @return an ArchiveEntry whose attributes are fetched from the given ZipEntry */ static ArchiveEntry createArchiveEntry(ZipEntry zipEntry) { ArchiveEntry entry = new ArchiveEntry(zipEntry.getName(), zipEntry.isDirectory(), zipEntry.getTime(), zipEntry.getSize(), true); if(zipEntry.hasUnixMode()) entry.setPermissions(new SimpleFilePermissions(zipEntry.getUnixMode())); entry.setEntryObject(zipEntry); return entry; }