From d706d5344b062caa2df692ebcd9945082e4fed1f Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Fri, 6 Oct 2017 01:33:07 -0400 Subject: [PATCH] +str add java Compression.gzip and deflate (#23779) --- .../akka/stream/javadsl/Compression.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/akka-stream/src/main/scala/akka/stream/javadsl/Compression.scala b/akka-stream/src/main/scala/akka/stream/javadsl/Compression.scala index c7f9f6443e..af754bfc8c 100644 --- a/akka-stream/src/main/scala/akka/stream/javadsl/Compression.scala +++ b/akka-stream/src/main/scala/akka/stream/javadsl/Compression.scala @@ -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 }