Java Code Examples for org.apache.hadoop.io.compress.CompressorStream

The following examples show how to use org.apache.hadoop.io.compress.CompressorStream. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: aliyun-maxcompute-data-collectors   Source File: LobFile.java    License: Apache License 2.0 5 votes vote down vote up
@Override
/**
 * {@inheritDoc}
 */
public OutputStream writeBlobRecord(long claimedLen) throws IOException {
  finishRecord(); // finish any previous record.
  checkForNull(this.out);
  startRecordIndex();
  this.header.getStartMark().write(out);
  LOG.debug("Starting new record; id=" + curEntryId
      + "; claimedLen=" + claimedLen);
  WritableUtils.writeVLong(out, curEntryId);
  WritableUtils.writeVLong(out, claimedLen);
  this.curClaimedLen = claimedLen;
  this.userCountingOutputStream = new CountingOutputStream(
      new CloseShieldOutputStream(out));
  if (null == this.codec) {
    // No codec; pass thru the same OutputStream to the user.
    this.userOutputStream = this.userCountingOutputStream;
  } else {
    // Wrap our CountingOutputStream in a compressing OutputStream to
    // give to the user.
    this.compressor.reset();
    this.userOutputStream = new CompressorStream(
        this.userCountingOutputStream, compressor);
  }

  return this.userOutputStream;
}
 
Example 2
Source Project: hadoop   Source File: FSImageFormatProtobuf.java    License: Apache License 2.0 4 votes vote down vote up
private void flushSectionOutputStream() throws IOException {
  if (codec != null) {
    ((CompressorStream) sectionOutputStream).finish();
  }
  sectionOutputStream.flush();
}
 
Example 3
Source Project: big-c   Source File: FSImageFormatProtobuf.java    License: Apache License 2.0 4 votes vote down vote up
private void flushSectionOutputStream() throws IOException {
  if (codec != null) {
    ((CompressorStream) sectionOutputStream).finish();
  }
  sectionOutputStream.flush();
}