Search in sources :

Example 1 with Handler

use of com.mucommander.commons.file.archive.sevenzip.provider.SevenZip.Archive.SevenZip.Handler in project mucommander by mucommander.

the class SevenZipArchiveFile method openSevenZipFile.

private IInArchive openSevenZipFile() throws IOException {
    if (sevenZipFile == null) {
        MuRandomAccessFile in = new MuRandomAccessFile(file);
        // MyRandomAccessFile in = new MyRandomAccessFile(file.getAbsolutePath(), "rw");
        sevenZipFile = new Handler();
        if (sevenZipFile.Open(in) != 0)
            throw new IOException("Error while opening 7zip archive " + file.getAbsolutePath());
    }
    return sevenZipFile;
}
Also used : Handler(com.mucommander.commons.file.archive.sevenzip.provider.SevenZip.Archive.SevenZip.Handler) IOException(java.io.IOException)

Example 2 with Handler

use of com.mucommander.commons.file.archive.sevenzip.provider.SevenZip.Archive.SevenZip.Handler in project mucommander by mucommander.

the class J7zip method main.

public static void main(String[] args) throws Exception {
    System.out.println("\nJ7zip 4.43 ALPHA 2 (" + Runtime.getRuntime().availableProcessors() + " CPUs)");
    if (args.length < 2) {
        PrintHelp();
        return;
    }
    final int MODE_LISTING = 0;
    final int MODE_TESTING = 1;
    final int MODE_EXTRACT = 2;
    int mode = -1;
    Vector<String> listOfNames = new Vector<String>();
    for (int i = 2; i < args.length; i++) listOfNames.add(args[i]);
    if (args[0].equals("l")) {
        mode = MODE_LISTING;
    } else if (args[0].equals("t")) {
        mode = MODE_TESTING;
    } else if (args[0].equals("x")) {
        mode = MODE_EXTRACT;
    } else {
        PrintHelp();
        return;
    }
    String filename = args[1];
    MyRandomAccessFile istream = new MyRandomAccessFile(filename, "r");
    IInArchive archive = new Handler();
    int ret = archive.Open(istream);
    if (ret != 0) {
        System.out.println("ERROR !");
        return;
    }
    switch(mode) {
        case MODE_LISTING:
            listing(archive, listOfNames, false);
            break;
        case MODE_TESTING:
            testOrExtract(archive, listOfNames, IInArchive.NExtract_NAskMode_kTest);
            break;
        case MODE_EXTRACT:
            testOrExtract(archive, listOfNames, IInArchive.NExtract_NAskMode_kExtract);
            break;
    }
    archive.close();
}
Also used : IInArchive(com.mucommander.commons.file.archive.sevenzip.provider.SevenZip.Archive.IInArchive) Handler(com.mucommander.commons.file.archive.sevenzip.provider.SevenZip.Archive.SevenZip.Handler) Vector(java.util.Vector)

Aggregations

Handler (com.mucommander.commons.file.archive.sevenzip.provider.SevenZip.Archive.SevenZip.Handler)2 IInArchive (com.mucommander.commons.file.archive.sevenzip.provider.SevenZip.Archive.IInArchive)1 IOException (java.io.IOException)1 Vector (java.util.Vector)1