Package org.apache.hadoop.io.compress

Examples of org.apache.hadoop.io.compress.BZip2Codec


    NumberFormat decimalFormatter = new DecimalFormat("0000");
    File dumpFile = new File(dumpFilePath);
    FileLineIterator it;
    if (dumpFilePath.endsWith(".bz2")) {
      // default compression format from http://download.wikimedia.org
      CompressionCodec codec = new BZip2Codec();
      it = new FileLineIterator(codec.createInputStream(new FileInputStream(dumpFile)));
    } else {
      // assume the user has previously de-compressed the dump file
      it = new FileLineIterator(dumpFile);
    }
    int filenumber = 0;
View Full Code Here


  static BZip2Codec bzipCodec = null;
  /** decompressing inputstream for .bz2 files. */
  static class BZip2InputStream extends FilterInputStream
  {   
    public BZip2InputStream(InputStream in) throws IOException {
      super((bzipCodec == null ? (bzipCodec = new BZip2Codec()) : bzipCodec).createInputStream(in));
    }   
View Full Code Here

 
  /** compressing outputstream for .bz2 files. */
  static class BZip2OutputStream extends FilterOutputStream
  {   
    public BZip2OutputStream(OutputStream in) throws IOException {
      super((bzipCodec == null ? (bzipCodec = new BZip2Codec()) : bzipCodec).createOutputStream(in));
    }
View Full Code Here

    NumberFormat decimalFormatter = new DecimalFormat("0000");
    File dumpFile = new File(dumpFilePath);
    FileLineIterator it;
    if (dumpFilePath.endsWith(".bz2")) {
      // default compression format from http://download.wikimedia.org
      CompressionCodec codec = new BZip2Codec();
      it = new FileLineIterator(codec.createInputStream(new FileInputStream(dumpFile)));
    } else {
      // assume the user has previously de-compressed the dump file
      it = new FileLineIterator(dumpFile);
    }
    int filenumber = 0;
View Full Code Here

    NumberFormat decimalFormatter = new DecimalFormat("0000");
    File dumpFile = new File(dumpFilePath);
    FileLineIterator it;
    if (dumpFilePath.endsWith(".bz2")) {
      // default compression format from http://download.wikimedia.org
      CompressionCodec codec = new BZip2Codec();
      it = new FileLineIterator(codec.createInputStream(new FileInputStream(dumpFile)));
    } else {
      // assume the user has previously de-compressed the dump file
      it = new FileLineIterator(dumpFile);
    }
    int filenumber = 0;
View Full Code Here

  public void testDefaultTextCompression() throws IOException {
    runTextCompressionTest(null, 4);
  }

  public void testBzip2TextCompression() throws IOException {
    runTextCompressionTest(new BZip2Codec(), 4);
  }
View Full Code Here

  public void testBzip2TextCompression() throws IOException {
    runTextCompressionTest(new BZip2Codec(), 4);
  }

  public void testBzip2SequenceFileCompression() throws Exception {
    runSequenceFileCompressionTest(new BZip2Codec(), 4);
  }
View Full Code Here

            CompressionCodec codec = null;


            // Use the codec according to the test case
            if (type.equals("bz2")) {
               codec = new BZip2Codec();
            } else if (type.equals("gz")) {
               codec = new GzipCodec();
            }
            if(codec instanceof Configurable) {
                ((Configurable)codec).setConf(new Configuration());
View Full Code Here

    NumberFormat decimalFormatter = new DecimalFormat("0000");
    File dumpFile = new File(dumpFilePath);
    FileLineIterator it;
    if (dumpFilePath.endsWith(".bz2")) {
      // default compression format from http://download.wikimedia.org
      CompressionCodec codec = new BZip2Codec();
      it = new FileLineIterator(codec.createInputStream(new FileInputStream(dumpFile)));
    } else {
      // assume the user has previously de-compressed the dump file
      it = new FileLineIterator(dumpFile);
    }
    int filenumber = 0;
View Full Code Here

    exWriter.close();
    String expected = new String(exWriter.toByteArray());

    // check the output to make sure it is what we expected.
    // read the gzip file and verify the contents
    BZip2Codec bz2Codec = new BZip2Codec();
    InputStream bz2in = bz2Codec.createInputStream(new FileInputStream(f
        .getPath() + "/sub-foo.bz2"));
    byte[] buf = new byte[1];
    StringBuilder output = new StringBuilder();

    while ((bz2in.read(buf)) > 0) {
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.compress.BZip2Codec

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.