Packages

o

fs2

compression

object compression

Provides utilities for compressing/decompressing byte streams.

Source
compression.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. compression
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. sealed trait DeflateParams extends AnyRef

    Deflate algorithm parameters.

  2. final case class GunzipResult[F[_]](content: Stream[F, Byte], modificationTime: Option[Instant] = None, fileName: Option[String] = None, comment: Option[String] = None) extends Product with Serializable

    Gunzip decompression results including file properties and decompressed content stream, used as follows: stream .through(gunzip[IO]()) .flatMap { gunzipResult => // Access properties here.

    Gunzip decompression results including file properties and decompressed content stream, used as follows: stream .through(gunzip[IO]()) .flatMap { gunzipResult => // Access properties here. gunzipResult.content }

    content

    Uncompressed content stream.

    modificationTime

    Modification time of compressed file.

    fileName

    File name.

    comment

    File comment.

  3. sealed trait InflateParams extends AnyRef

    Inflate algorithm parameters.

Deprecated Type Members

  1. final case class NonProgressiveDecompressionException(bufferSize: Int) extends RuntimeException with Product with Serializable
    Annotations
    @deprecated
    Deprecated

    (Since version 2020-02-05) No longer required

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. def deflate[F[_]](deflateParams: DeflateParams)(implicit SyncF: Sync[F]): Pipe[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.

    deflateParams

    See compression.DeflateParams

  7. def deflate[F[_]](level: Int = Deflater.DEFAULT_COMPRESSION, nowrap: Boolean = false, bufferSize: Int = 1024 * 32, strategy: Int = Deflater.DEFAULT_STRATEGY)(implicit SyncF: Sync[F]): Pipe[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.

    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.

    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

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. def gunzip[F[_]](inflateParams: InflateParams)(implicit 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.

    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.

    inflateParams

    See compression.InflateParams

    returns

    See compression.GunzipResult

  12. def gunzip[F[_]](bufferSize: Int = 1024 * 32)(implicit 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.

    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.

    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

  13. def gzip[F[_]](fileName: Option[String], modificationTime: Option[Instant], comment: Option[String], deflateParams: DeflateParams)(implicit SyncF: Sync[F]): Pipe[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.

    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.

    fileName

    optional file name

    modificationTime

    optional file modification time

    comment

    optional file comment

    deflateParams

    see compression.DeflateParams

  14. def gzip[F[_]](bufferSize: Int = 1024 * 32, deflateLevel: Option[Int] = None, deflateStrategy: Option[Int] = None, modificationTime: Option[Instant] = None, fileName: Option[String] = None, comment: Option[String] = None)(implicit SyncF: Sync[F]): Pipe[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.

    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.

    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.

    deflateLevel

    level the compression level (0-9)

    deflateStrategy

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

    modificationTime

    optional file modification time

    fileName

    optional file name

    comment

    optional file comment

  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. def inflate[F[_]](inflateParams: InflateParams)(implicit SyncF: Sync[F]): Pipe[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.

    inflateParams

    See compression.InflateParams

  17. def inflate[F[_]](nowrap: Boolean = false, bufferSize: Int = 1024 * 32)(implicit SyncF: Sync[F]): Pipe[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.

    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.

  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    AnyRef → Any
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. object DeflateParams
  28. object InflateParams
  29. object ZLibParams

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped