+str add java Compression.gzip and deflate (#23779)

This commit is contained in:
Alexander Golubev 2017-10-06 01:33:07 -04:00 committed by Konrad `ktoso` Malawski
parent ae0b9fe081
commit d706d5344b

View file

@ -23,4 +23,22 @@ object Compression {
*/
def inflate(maxBytesPerChunk: Int): Flow[ByteString, ByteString, NotUsed] =
scaladsl.Compression.inflate(maxBytesPerChunk).asJava
/**
* Creates a flow that gzip-compresses a stream of ByteStrings. Note that the compressor
* will SYNC_FLUSH after every [[ByteString]] so that it is guaranteed that every [[ByteString]]
* coming out of the flow can be fully decompressed without waiting for additional data. This may
* come at a compression performance cost for very small chunks.
*/
def gzip: Flow[ByteString, ByteString, NotUsed] =
scaladsl.Compression.gzip.asJava
/**
* Creates a flow that deflate-compresses a stream of ByteString. Note that the compressor
* will SYNC_FLUSH after every [[ByteString]] so that it is guaranteed that every [[ByteString]]
* coming out of the flow can be fully decompressed without waiting for additional data. This may
* come at a compression performance cost for very small chunks.
*/
def deflate: Flow[ByteString, ByteString, NotUsed] =
scaladsl.Compression.deflate.asJava
}