compression

object compression
Provides utilities for compressing/decompressing byte streams.
class Object
trait Matchable
class Any

Type members

Classlikes

object ZLibParams
sealed trait DeflateParams
Deflate algorithm parameters.
Companion
object
Companion
class
sealed trait InflateParams
Inflate algorithm parameters.
Companion
object
Companion
class
final case class GunzipResult[F <: ([_$20] =>> Any)](content: Stream[F, Byte], modificationTime: Option[Instant], fileName: Option[String], comment: Option[String])
Gunzip decompression results including file properties and
decompressed content stream, used as follows:
stream
.through(gunzipIO)
.flatMap { gunzipResult =>
// Access properties here.
gunzipResult.content
}
Value Params
comment
File comment.
content
Uncompressed content stream.
fileName
File name.
modificationTime
Modification time of compressed file.

Value members

Methods

def deflate[F <: ([_$1] =>> Any)](deflateParams: DeflateParams)(SyncF: Sync[F]): (F, Byte) => Byte
Returns a Pipe that deflates (compresses) its input elements using
the the Deflate algorithm.
Value Params
deflateParams
def inflate[F <: ([_$7] =>> Any)](inflateParams: InflateParams)(SyncF: Sync[F]): (F, Byte) => Byte
Returns a Pipe that inflates (decompresses) its input elements using
a java.util.zip.Inflater with the parameter nowrap.
Value Params
inflateParams
def gzip[F <: ([_$13] =>> Any)](bufferSize: Int, deflateLevel: Option[Int], deflateStrategy: Option[Int], modificationTime: Option[Instant], fileName: Option[String], comment: Option[String])(SyncF: Sync[F]): (F, Byte) => Byte
Returns a pipe that incrementally compresses input into the GZIP format
as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt. Output is
compatible with the GNU utils gunzip 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 utils gzip.
GZIP wraps a deflate stream with file attributes and stream integrity validation.
Therefore, GZIP is a good choice for compressing finite, complete, readily-available,
continuous or file streams. A simpler deflate stream may be better suited to
real-time, intermittent, fragmented, interactive or discontinuous streams where
network protocols typically provide stream integrity validation.
Value Params
bufferSize
The buffer size which will be used to page data
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%. Default
size is 32 KB.
comment
optional file comment
deflateLevel
level the compression level (0-9)
deflateStrategy
strategy compression strategy -- see java.util.zip.Deflater for details
fileName
optional file name
modificationTime
optional file modification time
def gzip[F <: ([_$14] =>> Any)](fileName: Option[String], modificationTime: Option[Instant], comment: Option[String], deflateParams: DeflateParams)(SyncF: Sync[F]): (F, Byte) => Byte
Returns a pipe that incrementally compresses input into the GZIP format
as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt. Output is
compatible with the GNU utils gunzip 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 utils gzip.
GZIP wraps a deflate stream with file attributes and stream integrity validation.
Therefore, GZIP is a good choice for compressing finite, complete, readily-available,
continuous or file streams. A simpler deflate stream may be better suited to
real-time, intermittent, fragmented, interactive or discontinuous streams where
network protocols typically provide stream integrity validation.
Value Params
comment
optional file comment
deflateParams
fileName
optional file name
modificationTime
optional file modification time
def gunzip[F <: ([_$21] =>> Any)](bufferSize: Int)(SyncF: Sync[F]): Stream[F, Byte] => Stream[F, GunzipResult[F]]
Returns a pipe that incrementally decompresses input according to the GZIP
format as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt. Any
errors in decompression will be sequenced as exceptions into the output
stream. Decompression is handled in a streaming and async fashion without
any thread blockage.
The chunk size here is actually really important. Matching the input stream
largest chunk size, or roughly 8 KB (whichever is larger) is a good rule of
thumb.
Value Params
bufferSize
The bounding size of the input buffer. This should roughly
match the size of the largest chunk in the input stream.
This will also be the chunk size in the output stream.
Default size is 32 KB.
Returns
def gunzip[F <: ([_$22] =>> Any)](inflateParams: InflateParams)(SyncF: Sync[F]): Stream[F, Byte] => Stream[F, GunzipResult[F]]
Returns a pipe that incrementally decompresses input according to the GZIP
format as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt. Any
errors in decompression will be sequenced as exceptions into the output
stream. Decompression is handled in a streaming and async fashion without
any thread blockage.
The chunk size here is actually really important. Matching the input stream
largest chunk size, or roughly 8 KB (whichever is larger) is a good rule of
thumb.
Value Params
inflateParams
Returns