Examples of BZip2CompressorInputStream


Examples of org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

            ais = new ZipArchiveInputStream(is);
        } else {
            if ("gz".equals(archiveFormat)) {
                is = new GZIPInputStream(is);
            } else if ("bz2".equals(archiveFormat)) {
                is = new BZip2CompressorInputStream(is);
            } else {
                throw new IllegalStateException("Unsupported compression format " + archiveFormat + "!. "
                                                + "Please report this to stanbol-dev mailing list!");
            }
            ais = new TarArchiveInputStream(is);
View Full Code Here

Examples of org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

        if ("gz".equalsIgnoreCase(FilenameUtils.getExtension(name))) {
            is = new GZIPInputStream(is);
            name = FilenameUtils.removeExtension(name);
            log.debug("   - from GZIP Archive");
        } else if ("bz2".equalsIgnoreCase(FilenameUtils.getExtension(name))) {
            is = new BZip2CompressorInputStream(is);
            name = FilenameUtils.removeExtension(name);
            log.debug("   - from BZip2 Archive");
        }// TODO: No Zip Files inside Zip Files supported :o( ^^
        Lang format = Lang.guess(name);
        // For N-Triple we can use the TDBLoader
View Full Code Here

Examples of org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

        try {
            int signatureLength = in.read(signature);
            in.reset();

            if (BZip2CompressorInputStream.matches(signature, signatureLength)) {
                return new BZip2CompressorInputStream(in);
            }

            if (GzipCompressorInputStream.matches(signature, signatureLength)) {
                return new GzipCompressorInputStream(in);
            }
View Full Code Here

Examples of org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

            if (GZIP.equalsIgnoreCase(name)) {
                return new GzipCompressorInputStream(in);
            }

            if (BZIP2.equalsIgnoreCase(name)) {
                return new BZip2CompressorInputStream(in);
            }

            if (PACK200.equalsIgnoreCase(name)) {
                return new Pack200CompressorInputStream(in);
            }
View Full Code Here

Examples of org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

        System.out.println("unpacking db to "+targetDir);

        TarArchiveEntry entry;
        try (TarArchiveInputStream tis = new TarArchiveInputStream(
                new BZip2CompressorInputStream(
                        new FileInputStream(input))
        )) {
            while ((entry = tis.getNextTarEntry()) != null) {
                File file = new File(targetDir.getParentFile(), entry.getName());
                if (entry.isDirectory()) {
View Full Code Here

Examples of org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

        stream.reset();

        // Select decompression or unpacking mechanism based on the two bytes
        if (a == 'B' && b == 'Z') {
            metadata.set(Metadata.CONTENT_TYPE, "application/x-bzip");
            decompress(new BZip2CompressorInputStream(stream), xhtml);
        } else if (a == 0x1f && b == 0x8b) {
            metadata.set(Metadata.CONTENT_TYPE, "application/x-gzip");
            decompress(new GZIPInputStream(stream), xhtml);
        } else if (a == 'P' && b == 'K') {
            metadata.set(Metadata.CONTENT_TYPE, "application/zip");
View Full Code Here

Examples of org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

     */
    public static byte[] extractBZip2(byte[] bytes) {
        try {
            InputStream bytesIS = new ByteArrayInputStream(bytes);
            ByteArrayOutputStream bytesUncompressedOS = new ByteArrayOutputStream();
            BZip2CompressorInputStream bzip2CompressorIS = new BZip2CompressorInputStream(bytesIS);

            ByteStreams.copy(bzip2CompressorIS, bytesUncompressedOS);
            bzip2CompressorIS.close();

            return bytesUncompressedOS.toByteArray();
        } catch (IOException e) {
            logger.log(Level.SEVERE, "Error while uncompressing", e);
            return null;
View Full Code Here

Examples of org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

        if ("gz".equalsIgnoreCase(FilenameUtils.getExtension(name))) {
            is = new GZIPInputStream(is);
            name = FilenameUtils.removeExtension(name);
            log.debug("   - from GZIP Archive");
        } else if ("bz2".equalsIgnoreCase(FilenameUtils.getExtension(name))) {
            is = new BZip2CompressorInputStream(is);
            name = FilenameUtils.removeExtension(name);
            log.debug("   - from BZip2 Archive");
        }// TODO: No Zip Files inside Zip Files supported :o( ^^
        Lang format = Lang.guess(name);
        // For N-Triple we can use the TDBLoader
View Full Code Here

Examples of org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

            in = new ZipInputStream(in);
            ((ZipInputStream)in).getNextEntry();
        } else if("gz".equalsIgnoreCase(extension)) {
            in = new GZIPInputStream(in);
        } else if("bz2".equalsIgnoreCase(extension)) {
            in = new BZip2CompressorInputStream(in);
        }
        return in;
    }
View Full Code Here

Examples of org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

               Java :'( */
            try {
                input = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream(file)));
            } catch (IOException e) {
                try {
                    input = new TarArchiveInputStream(new BZip2CompressorInputStream(new FileInputStream(file)));
                } catch (IOException e2) {
                    input = new ZipArchiveInputStream(new FileInputStream(file));
                }
            }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.