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

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


  private final ArchiveCommand.Format<ArchiveOutputStream> tarFormat = new TarFormat();

  public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
      throws IOException {
    BZip2CompressorOutputStream out = new BZip2CompressorOutputStream(s);
    return tarFormat.createArchiveOutputStream(out);
  }
View Full Code Here


     */
    public static byte[] compressBZip2(byte[] bytes) {
        try {
            InputStream bytesIS = new ByteArrayInputStream(bytes);
            ByteArrayOutputStream bytesCompressedOS = new ByteArrayOutputStream();
            BZip2CompressorOutputStream bzip2CompressorOS = new BZip2CompressorOutputStream(bytesCompressedOS);

            ByteStreams.copy(bytesIS, bzip2CompressorOS);
            bzip2CompressorOS.close();

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

            out = new ZipOutputStream(out);
            ((ZipOutputStream)out).putNextEntry(new ZipEntry("entity-ids.txt"));
        } else if("gz".equalsIgnoreCase(extension)) {
            out = new GZIPOutputStream(out);
        } else if("bz2".equalsIgnoreCase(extension)) {
            out = new BZip2CompressorOutputStream(out);
        }
        return out;
    }
View Full Code Here

     * @throws IOException
     */
    private static void _compressBZip2(InputStream source, OutputStream target) throws IOException {
       
        InputStream is = IOUtil.toBufferedInputStream(source);
        OutputStream os = new BZip2CompressorOutputStream(IOUtil.toBufferedOutputStream(target));
        IOUtil.copy(is,os,true,true);
    }
View Full Code Here

            if (GZIP.equalsIgnoreCase(name)) {
                return new GzipCompressorOutputStream(out);
            }

            if (BZIP2.equalsIgnoreCase(name)) {
                return new BZip2CompressorOutputStream(out);
            }

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

        }
        @Override
        OutputStream encode(final OutputStream out, final Object options)
                throws IOException {
            int blockSize = numberOptionOrDefault(options, BZip2CompressorOutputStream.MAX_BLOCKSIZE);
            return new BZip2CompressorOutputStream(out, blockSize);
        }
View Full Code Here

                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
            BlockingQueue<String> queue = new ArrayBlockingQueue<String>(1000);
View Full Code Here

        {
            BufferedOutputStream bos =
                new BufferedOutputStream( new FileOutputStream( getDestFile() ) );
            bos.write( 'B' );
            bos.write( 'Z' );
            zOut = new BZip2CompressorOutputStream( bos );
            compress( getSource(), zOut );
        }
        catch ( IOException ioe )
        {
            String msg = "Problem creating bzip2 " + ioe.getMessage();
View Full Code Here

  @Override
  public byte[] deflate(InputStream data) throws CompressionException
  {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    BZip2CompressorOutputStream compressor = null;

    try
    {
      out = new ByteArrayOutputStream();
      compressor = new BZip2CompressorOutputStream(out);

      IOUtils.copy(data, compressor);
      compressor.finish();
    }
    catch (IOException e)
    {
      throw new CompressionException(CompressionConstants.DECODING_ERROR + getContentEncodingName(), e);
    }
View Full Code Here

            if (GZIP.equalsIgnoreCase(name)) {
                return new GzipCompressorOutputStream(out);
            }
           
            if (BZIP2.equalsIgnoreCase(name)) {
                return new BZip2CompressorOutputStream(out);
            }
       
        } catch (IOException e) {
            throw new CompressorException(
                    "Could not create CompressorOutputStream", e);
View Full Code Here

TOP

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

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.