Package com.dotcms.repackage.org.apache.commons.compress.compressors.bzip2

Examples of com.dotcms.repackage.org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream


  }

  @Override
  public ByteBuffer decompress(ByteBuffer compressedData) throws IOException {
    ByteArrayInputStream bais = new ByteArrayInputStream(compressedData.array());
    BZip2CompressorInputStream inputStream = new BZip2CompressorInputStream(bais);
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();

      byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];

      int readCount = -1;
     
      while ( (readCount = inputStream.read(buffer, compressedData.position(), buffer.length))> 0) {
        baos.write(buffer, 0, readCount);
      }
     
      ByteBuffer result = ByteBuffer.wrap(baos.toByteArray());
      return result;
    } finally {
      inputStream.close();
    }
  }
View Full Code Here


  }

  @Override
  public ByteBuffer decompress(ByteBuffer compressedData) throws IOException {
    ByteArrayInputStream bais = new ByteArrayInputStream(compressedData.array());
    BZip2CompressorInputStream inputStream = new BZip2CompressorInputStream(bais);
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();

      byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];

      int readCount = -1;
     
      while ( (readCount = inputStream.read(buffer, compressedData.position(), buffer.length))> 0) {
        baos.write(buffer, 0, readCount);
      }
     
      ByteBuffer result = ByteBuffer.wrap(baos.toByteArray());
      return result;
    } finally {
      inputStream.close();
    }
  }
View Full Code Here

        WikiPageParser k = new WikiPageParser(graph, content, categories, linksEN, coordinates, population, area, language);
       
        BufferedReader br;
        if (wikipedia.endsWith(".bz2")) { //.bz2
            FileInputStream fis = new FileInputStream(wikipedia);
            br = new BufferedReader(new InputStreamReader(new BZip2CompressorInputStream(fis), "UTF-8"));
        } else { //.xml
            br = new BufferedReader(new FileReader(wikipedia));
        }
       
        parser.parse(new InputSource(br), k);
View Full Code Here

            br = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(wikiDumpFilename)), "UTF-8"));

        } else if (wikiDumpFilename.endsWith(".bz2")) {
            FileInputStream fis = new FileInputStream(wikiDumpFilename);
            br = new BufferedReader(new InputStreamReader(new BZip2CompressorInputStream(fis, true), "UTF-8"));
        } else {
            br = new BufferedReader(new InputStreamReader(new FileInputStream(wikiDumpFilename), "UTF-8"));
        }

        return br;
View Full Code Here

    static class BZIP2Decoder extends CoderBase {
        @Override
        InputStream decode(final InputStream in, final Coder coder, final byte[] password)
                throws IOException {
            return new BZip2CompressorInputStream(in);
        }
View Full Code Here

        try {
            int signatureLength = IOUtils.readFully(in, signature);
            in.reset();

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

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

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

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

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

        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,
                true); //use true as 2nd param (see http://s.apache.org/QbK)
            name = FilenameUtils.removeExtension(name);
            log.debug("   - from BZip2 Archive");
        }// TODO: No Zip Files inside Zip Files supported :o( ^^
        Lang format = RDFLanguages.filenameToLang(name);
View Full Code Here

                is = new GZIPInputStream(is);
                os = new GZIPOutputStream(os);
                name = FilenameUtils.removeExtension(name);
                log.debug("   - from GZIP Archive");
            } else if ("bz2".equalsIgnoreCase(FilenameUtils.getExtension(name))) {
                is = new BZip2CompressorInputStream(is);
                os = new BZip2CompressorOutputStream(os);
                name = FilenameUtils.removeExtension(name);
                log.debug("   - from BZip2 Archive");
            }// TODO: No Zip File support
            //else no complression
View Full Code Here

            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

TOP

Related Classes of com.dotcms.repackage.org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream

Copyright © 2018 www.massapicom. 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.