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

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


    public BZip2Compressor(){
        super();
    }

    public void compressTo(InputStream in, OutputStream out) throws CompressException {
        BZip2CompressorOutputStream outputBZStream = null;
        try {
            outputBZStream = new BZip2CompressorOutputStream(out);
            NioUtils.copy(in, outputBZStream);
            outputBZStream.finish();
        } catch (Exception e) {
            throw new CompressException("bzip_compress_error", e);
        }
    }
View Full Code Here


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

            {
                return new GZIPOutputStream( ostream );
            }
            else if ( BZIP2.equals( value ) )
            {
                return new BZip2CompressorOutputStream( ostream );
            }
            return ostream;
        }
View Full Code Here

            {
                return new GZIPOutputStream( ostream );
            }
            else if ( BZIP2.equals( value ) )
            {
                return new BZip2CompressorOutputStream( ostream );
            }
            return ostream;
        }
View Full Code Here

            }
            else if ( BZIP2.equals( value ) )
            {
                ostream.write( 'B' );
                ostream.write( 'Z' );
                return new BZip2CompressorOutputStream( ostream );
            }
            return ostream;
        }
View Full Code Here

    @Override
    protected OutputStream doGetOutputStream(final boolean bAppend) throws Exception
    {
        final OutputStream os = getContainer().getContent().getOutputStream(false);
        return new BZip2CompressorOutputStream(os);
    }
View Full Code Here

      if (CompressionMethod.GZip.equals(compressionMethod)) {
        return new GZIPOutputStream(destinationStream);
      }
     
      if (CompressionMethod.BZip2.equals(compressionMethod)) {
        return new BZip2CompressorOutputStream(destinationStream);
      }
     
      throw new OsmosisRuntimeException("Compression method " + compressionMethod + " is not recognized.");
     
    } catch (IOException e) {
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

        channel.writeInbound(in);
    }

    private static void testDecompression(final EmbeddedChannel channel, final byte[] data) throws Exception {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        BZip2CompressorOutputStream bZip2Os = new BZip2CompressorOutputStream(os, randomBlockSize());
        bZip2Os.write(data);
        bZip2Os.close();

        ByteBuf compressed = Unpooled.wrappedBuffer(os.toByteArray());
        channel.writeInbound(compressed);

        ByteBuf uncompressed = readUncompressed(channel);
View Full Code Here

    @Test
    public void testDecompressionOfBatchedFlowOfData() throws Exception {
        final byte[] data = BYTES_LARGE;

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        BZip2CompressorOutputStream bZip2Os = new BZip2CompressorOutputStream(os, randomBlockSize());
        bZip2Os.write(data);
        bZip2Os.close();

        final byte[] compressedArray = os.toByteArray();
        int written = 0, length = rand.nextInt(100);
        while (written + length < compressedArray.length) {
            ByteBuf compressed = Unpooled.wrappedBuffer(compressedArray, written, length);
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.