Search in sources :

Example 1 with SingleArchiveEntryIterator

use of com.mucommander.commons.file.archive.SingleArchiveEntryIterator in project mucommander by mucommander.

the class Bzip2ArchiveFile method getEntryIterator.

// //////////////////////////////////////
// AbstractArchiveFile implementation //
// //////////////////////////////////////
@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
        extension = extension.toLowerCase();
        int extensionIndex = name.toLowerCase().lastIndexOf("." + extension);
        if (extensionIndex > -1)
            name = name.substring(0, extensionIndex);
        if (extension.equals("tbz2") || extension.equals("tar.bz2"))
            name += ".tar";
    }
    return new SingleArchiveEntryIterator(new ArchiveEntry("/" + name, false, getDate(), -1, true));
}
Also used : SingleArchiveEntryIterator(com.mucommander.commons.file.archive.SingleArchiveEntryIterator) ArchiveEntry(com.mucommander.commons.file.archive.ArchiveEntry)

Example 2 with SingleArchiveEntryIterator

use of com.mucommander.commons.file.archive.SingleArchiveEntryIterator in project mucommander by mucommander.

the class GzipArchiveFile method getEntryIterator.

// //////////////////////////////////////
// AbstractArchiveFile implementation //
// //////////////////////////////////////
@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
        extension = extension.toLowerCase();
        int extensionIndex = name.toLowerCase().lastIndexOf("." + extension);
        if (extensionIndex > -1)
            name = name.substring(0, extensionIndex);
        if (extension.equals("tgz") || extension.equals("tar.gz"))
            name += ".tar";
    }
    return new SingleArchiveEntryIterator(new ArchiveEntry("/" + name, false, getDate(), -1, true));
}
Also used : SingleArchiveEntryIterator(com.mucommander.commons.file.archive.SingleArchiveEntryIterator) ArchiveEntry(com.mucommander.commons.file.archive.ArchiveEntry)

Example 3 with SingleArchiveEntryIterator

use of com.mucommander.commons.file.archive.SingleArchiveEntryIterator in project mucommander by mucommander.

the class XzArchiveFile method getEntryIterator.

// //////////////////////////////////////
// AbstractArchiveFile implementation //
// //////////////////////////////////////
@Override
public ArchiveEntryIterator getEntryIterator() throws IOException {
    String extension = getCustomExtension() != null ? getCustomExtension() : getExtension();
    String name = getName();
    if (extension != null) {
        // Remove the 'xz' or 'txz' extension from the entry's name
        extension = extension.toLowerCase();
        int extensionIndex = name.toLowerCase().lastIndexOf("." + extension);
        if (extensionIndex > -1)
            name = name.substring(0, extensionIndex);
        if (extension.equals("txz") || extension.equals("tar.xz"))
            name += ".tar";
    }
    return new SingleArchiveEntryIterator(new ArchiveEntry("/" + name, false, getDate(), -1, true));
}
Also used : SingleArchiveEntryIterator(com.mucommander.commons.file.archive.SingleArchiveEntryIterator) ArchiveEntry(com.mucommander.commons.file.archive.ArchiveEntry)

Aggregations

ArchiveEntry (com.mucommander.commons.file.archive.ArchiveEntry)3 SingleArchiveEntryIterator (com.mucommander.commons.file.archive.SingleArchiveEntryIterator)3