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

The following examples show how to use org.apache.hadoop.io.compress.CompressorStream. 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 File: LobFile.java    From aliyun-maxcompute-data-collectors with 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 File: FSImageFormatProtobuf.java    From hadoop with 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 File: FSImageFormatProtobuf.java    From big-c with Apache License 2.0 4 votes vote down vote up
private void flushSectionOutputStream() throws IOException {
  if (codec != null) {
    ((CompressorStream) sectionOutputStream).finish();
  }
  sectionOutputStream.flush();
}