Java Code Examples for org.xerial.snappy.SnappyFramedOutputStream

The following examples show how to use org.xerial.snappy.SnappyFramedOutputStream. 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: galaxy-sdk-java   Source File: CompressionStreamAdaptor.java    License: Apache License 2.0 5 votes vote down vote up
public static OutputStream getOutputStream(OutputStream outputStream, Compression compression)
    throws IOException {
  if (compression != null) {
    switch (compression) {
    case SNAPPY:
      return new SnappyFramedOutputStream(outputStream);
    case NONE:
      return outputStream;
    default:
      throw new IllegalArgumentException("Unsupported compression codec: " + compression);
    }
  }
  return outputStream;
}
 
Example 2
Source Project: kangaroo   Source File: SnappyFramedCodec.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public CompressionOutputStream createOutputStream(final OutputStream out, final Compressor compressor)
        throws IOException {
    LOG.info("Creating compressor stream");
    return new OStreamDelegatingCompressorStream(new SnappyFramedOutputStream(out, conf.getInt(
            COMPRESSION_BLOCK_SIZE_CONF, SnappyFramedOutputStream.DEFAULT_BLOCK_SIZE),
            SnappyFramedOutputStream.DEFAULT_MIN_COMPRESSION_RATIO));
}
 
Example 3
@Override
protected OutputStream decorateWithCompression(NonClosingOutpusStreamDecorator stream) throws IOException {
	return new SnappyFramedOutputStream(stream, COMPRESSION_BLOCK_SIZE, MIN_COMPRESSION_RATIO);
}
 
Example 4
Source Project: flink   Source File: SnappyStreamCompressionDecorator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected OutputStream decorateWithCompression(NonClosingOutpusStreamDecorator stream) throws IOException {
	return new SnappyFramedOutputStream(stream, COMPRESSION_BLOCK_SIZE, MIN_COMPRESSION_RATIO);
}
 
Example 5
Source Project: flink   Source File: SnappyStreamCompressionDecorator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected OutputStream decorateWithCompression(NonClosingOutpusStreamDecorator stream) throws IOException {
	return new SnappyFramedOutputStream(stream, COMPRESSION_BLOCK_SIZE, MIN_COMPRESSION_RATIO);
}