Example usage for org.apache.hadoop.io.compress.bzip2 CBZip2OutputStream CBZip2OutputStream

List of usage examples for org.apache.hadoop.io.compress.bzip2 CBZip2OutputStream CBZip2OutputStream

Introduction

In this page you can find the example usage for org.apache.hadoop.io.compress.bzip2 CBZip2OutputStream CBZip2OutputStream.

Prototype

public CBZip2OutputStream(final OutputStream out) throws IOException 

Source Link

Document

Constructs a new CBZip2OutputStream with a blocksize of 900k.

Usage

From source file:com.mucommander.commons.file.archiver.Archiver.java

License:Open Source License

/**
 * Creates and returns a Bzip2 <code>OutputStream</code> using the given <code>OutputStream</code> as the underlying
 * stream.//from   w  ww. j a v  a 2s  . c o  m
 *
 * @param out the underlying stream
 * @return a Bzip2 OutputStream
 * @throws IOException if an error occurred while initializing the Bzip2 OutputStream
 */
protected static OutputStream createBzip2OutputStream(OutputStream out) throws IOException {
    // Writes the 2 magic bytes 'BZ', as required by CBZip2OutputStream. A quote from CBZip2OutputStream's Javadoc:
    // "Attention: The caller is resonsible to write the two BZip2 magic bytes "BZ" to the specified stream
    // prior to calling this constructor."

    out.write('B');
    out.write('Z');

    return new CBZip2OutputStream(out);
}