compression

object compression

Provides utilities for compressing/decompressing byte streams.

Provides utilities for compressing/decompressing byte streams.

class Object
trait Matchable
class Any

Type members

Classlikes

sealed trait DeflateParams

Deflate algorithm parameters.

Deflate algorithm parameters.

Companion
object
Companion
class
final case class GunzipResult[F[_]](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 }

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.

sealed trait InflateParams

Inflate algorithm parameters.

Inflate algorithm parameters.

Companion
object
Companion
class
object ZLibParams

Deprecated classlikes

@deprecated("No longer required", "2020-02-05")
final case class NonProgressiveDecompressionException(bufferSize: Int) extends RuntimeException
Deprecated

Value members

Concrete methods

def deflate[F[_]](level: Int, nowrap: Boolean, bufferSize: Int, strategy: Int)(SyncF: Sync[F]): (F, Byte) => Byte

Returns a Pipe that deflates (compresses) its input elements using a java.util.zip.Deflater with the parameters level, nowrap and strategy. Parameter flush mode is set to NO_FLUSH - use compression.deflate(DeflateParams) to configure this.

Returns a Pipe that deflates (compresses) its input elements using a java.util.zip.Deflater with the parameters level, nowrap and strategy. Parameter flush mode is set to NO_FLUSH - use compression.deflate(DeflateParams) to configure this.

Value Params
bufferSize

size of the internal buffer that is used by the compressor. Default size is 32 KB.

level

the compression level (0-9)

nowrap

if true then use GZIP compatible compression

strategy

compression strategy -- see java.util.zip.Deflater for details

def deflate[F[_]](deflateParams: DeflateParams)(SyncF: Sync[F]): (F, Byte) => Byte

Returns a Pipe that deflates (compresses) its input elements using the the Deflate algorithm.

Returns a Pipe that deflates (compresses) its input elements using the the Deflate algorithm.

Value Params
deflateParams

See compression.DeflateParams

def gunzip[F[_]](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.

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

See compression.GunzipResult

def gunzip[F[_]](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.

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

See compression.InflateParams

Returns

See compression.GunzipResult

def gzip[F[_]](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.

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[_]](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.

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

see compression.DeflateParams

fileName

optional file name

modificationTime

optional file modification time

def inflate[F[_]](nowrap: Boolean, bufferSize: Int)(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.

Returns a Pipe that inflates (decompresses) its input elements using a java.util.zip.Inflater with the parameter nowrap.

Value Params
bufferSize

size of the internal buffer that is used by the decompressor. Default size is 32 KB.

nowrap

if true then support GZIP compatible decompression

def inflate[F[_]](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.

Returns a Pipe that inflates (decompresses) its input elements using a java.util.zip.Inflater with the parameter nowrap.

Value Params
inflateParams

See compression.InflateParams