object compress
Provides utilities for compressing/decompressing byte streams.
- Annotations
- @deprecated
- Deprecated
(Since version 2.3.0) Use fs2.compression instead
- Source
- compress.scala
- Alphabetic
- By Inheritance
- compress
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final case class NonProgressiveDecompressionException(bufferSize: Int) extends RuntimeException with Product with Serializable
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def deflate[F[_]](level: Int = Deflater.DEFAULT_COMPRESSION, nowrap: Boolean = false, bufferSize: Int = 1024 * 32, strategy: Int = Deflater.DEFAULT_STRATEGY): Pipe[F, Byte, Byte]
Returns a
Pipe
that deflates (compresses) its input elements using ajava.util.zip.Deflater
with the parameterslevel
,nowrap
andstrategy
.Returns a
Pipe
that deflates (compresses) its input elements using ajava.util.zip.Deflater
with the parameterslevel
,nowrap
andstrategy
.- level
the compression level (0-9)
- nowrap
if true then use GZIP compatible compression
- bufferSize
size of the internal buffer that is used by the compressor. Default size is 32 KB.
- strategy
compression strategy -- see
java.util.zip.Deflater
for details
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def gunzip[F[_]](bufferSize: Int)(implicit arg0: RaiseThrowable[F]): Pipe[F, Byte, Byte]
Returns a pipe that incrementally decompresses input according to the GZIP format.
Returns a pipe that incrementally decompresses input according to the GZIP format. Any errors in decompression will be sequenced as exceptions into the output stream. The implementation of this pipe delegates directly to
GZIPInputStream
. Despite this, decompression is still handled in a streaming and async fashion without any thread blockage. Under the surface, this is handled by enqueueing chunks into a special type of byte array InputStream which throws exceptions when exhausted rather than blocking. These signal exceptions are caught by the pipe and treated as an async suspension. Thus, there are no issues with arbitrarily-framed data and chunk boundaries. Also note that there is almost no performance impact from these exceptions, due to the way that the JVM handles throw/catch.The chunk size here is actually really important. If you set it to be too small, then there will be insufficient buffer space for
GZIPInputStream
to read the GZIP header preamble. This can result in repeated, non-progressing async suspensions. This case is caught internally and will be raised as an exception (NonProgressiveDecompressionException
) within the output stream. Under normal circumstances, you shouldn't have to worry about this. Just, uh, don't set the buffer size to something tiny. Matching the input stream largest chunk size, or roughly 8 KB (whichever is larger) is a good rule of thumb.- bufferSize
The bounding size of the input buffer. This should roughly match the size of the largest chunk in the input stream. The chunk size in the output stream will be determined by double this value.
- def gzip[F[_]](bufferSize: Int): Pipe[F, Byte, Byte]
Returns a pipe that incrementally compresses input into the GZIP format by delegating to
java.util.zip.GZIPOutputStream
.Returns a pipe that incrementally compresses input into the GZIP format by delegating to
java.util.zip.GZIPOutputStream
. Output is compatible with the GNU utilsgunzip
utility, as well as really anything else that understands GZIP. Note, however, that the GZIP format is not "stable" in the sense that all compressors will produce identical output given identical input. Part of the header seeding is arbitrary and chosen by the compression implementation. For this reason, the exact bytes produced by this pipe will differ in insignificant ways from the exact bytes produced by a tool like the GNU utilsgzip
.- bufferSize
The buffer size which will be used to page data from the OutputStream back into chunks. This will be the chunk size of the output stream. You should set it to be equal to the size of the largest chunk in the input stream. Setting this to a size which is smaller than the chunks in the input stream will result in performance degradation of roughly 50-75%.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def inflate[F[_]](nowrap: Boolean = false, bufferSize: Int = 1024 * 32)(implicit ev: RaiseThrowable[F]): Pipe[F, Byte, Byte]
Returns a
Pipe
that inflates (decompresses) its input elements using ajava.util.zip.Inflater
with the parameternowrap
.Returns a
Pipe
that inflates (decompresses) its input elements using ajava.util.zip.Inflater
with the parameternowrap
.- nowrap
if true then support GZIP compatible decompression
- bufferSize
size of the internal buffer that is used by the decompressor. Default size is 32 KB.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated