Object

com.github.gekomad.scalacompress

Compressors

Related Doc: package scalacompress

Permalink

object Compressors

Compressors

Since

0.0.1

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Compressors
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class StreamCompress(compressorName: StreamableCompressor, out: OutputStream) extends Product with Serializable

    Permalink
  2. case class StreamDecompress(compressorName: StreamableCompressor, in: InputStream) extends Product with Serializable

    Permalink

    Decompressing stream example

    Decompressing stream example

    val zStream     = StreamDecompress(StreamableCompressor.GZ, new FileInputStream("/tmp/compressedFile"))
    //  val zStream     = StreamDecompress(StreamableCompressor.DEFLATE, new FileInputStream("/tmp/compressedFile"))
    //  val zStream     = StreamDecompress(StreamableCompressor.BZ2, new FileInputStream("/tmp/compressedFile"))
    //  val zStream     = StreamDecompress(StreamableCompressor.PACK200, new FileInputStream("/tmp/compressedFile"))
    //  val zStream     = StreamDecompress(StreamableCompressor.XZ, new FileInputStream("/tmp/compressedFile"))
    //  val zStream     = StreamDecompress(StreamableCompressor.ZSTANDARD, new FileInputStream("/tmp/compressedFile"))
    //  val zStream     = StreamDecompress(StreamableCompressor.LZMA, new FileInputStream("/tmp/compressedFile"))
    //  val zStream     = StreamDecompress(StreamableCompressor.LZ4, new FileInputStream("/tmp/compressedFile"))
    //  val zStream     = StreamDecompress(StreamableCompressor.Snappy1, new FileInputStream("/tmp/compressedFile"))
    val buffer       = new Array[Byte](2)
    val decompressed = new StringBuilder
    
    @tailrec
    def readBuffer(): Unit = {
      zStream.readInBuffer(buffer) match {
        case Failure(exception) => exception.printStackTrace
        case Success(bytesRead) =>
          if (bytesRead != -1) {
            decompressed.append(new String(buffer, StandardCharsets.UTF_8))
            readBuffer()
          } else {
            println
            zStream.close()
          }
      }
    }
    readBuffer()
    val cl: Try[Unit] = zStream.close()
    assert(decompressed.toString == "foobar")

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object StreamableCompressor extends Enumeration

    Permalink
  5. def arCompress(src: List[String], dest: String): Try[CompressionStats]

    Permalink

    src

    File and folder to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  6. def arDecompress(src: String, dest: String, entries: Option[List[String]] = None): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    entries

    If != None extract only these entries

    returns

    Statistics on decompression procedure

  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def bzip2Compress(src: String, dest: String): Try[CompressionStats]

    Permalink

    src

    File to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  9. def bzip2Decompress(src: String, dest: String): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  11. def compressStream(compressorName: StreamableCompressor, in: InputStream, out: OutputStream): Try[Unit]

    Permalink

    val in: InputStream     = ???
    val out: OutputStream   = ???
    val compress: Try[Unit] = compressStream(StreamableCompressor.GZ, in, out)
    //    val compress: Try[Unit] = compressStream(StreamableCompressor.DEFLATE, in, out)
    //    val compress: Try[Unit] = compressStream(StreamableCompressor.BZ2, in, out)
    //    val compress: Try[Unit] = compressStream(StreamableCompressor.PACK200, in, out)
    //    val compress: Try[Unit] = compressStream(StreamableCompressor.XZ, in, out)
    //    val compress: Try[Unit] = compressStream(StreamableCompressor.ZSTANDARD, in, out)
    //    val compress: Try[Unit] = compressStream(StreamableCompressor.LZMA, in, out)
    //    val compress: Try[Unit] = compressStream(StreamableCompressor.LZ4, in, out)
    //    val compress: Try[Unit] = compressStream(StreamableCompressor.SNAPPY, in, out)
  12. def cpioCompress(src: List[String], dest: String): Try[CompressionStats]

    Permalink

    src

    File and folder to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  13. def cpioDecompress(src: String, dest: String, entries: Option[List[String]] = None): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    entries

    If != None extract only these entries

    returns

    Statistics on decompression procedure

  14. def decompressStream(compressorName: StreamableCompressor, in: InputStream, out: OutputStream): Try[Unit]

    Permalink

    val in: InputStream = ???
    val out: OutputStream = ???
    val decompress: Try[Unit] = decompressStream(StreamableCompressor.GZ,in, out)
    //    val decompress: Try[Unit] = decompressStream(StreamableCompressor.DEFLATE,in, out)
    //    val decompress: Try[Unit] = decompressStream(StreamableCompressor.BZ2,in, out)
    //    val decompress: Try[Unit] = decompressStream(StreamableCompressor.PACK200,in, out)
    //    val decompress: Try[Unit] = decompressStream(StreamableCompressor.XZ,in, out)
    //    val decompress: Try[Unit] = decompressStream(StreamableCompressor.ZSTANDARD,in, out)
    //    val decompress: Try[Unit] = decompressStream(StreamableCompressor.LZMA,in, out)
    //    val decompress: Try[Unit] = decompressStream(StreamableCompressor.LZ4,in, out)
    //    val decompress: Try[Unit] = decompressStream(StreamableCompressor.SNAPPY,in, out)
  15. def deflateCompress(src: String, dest: String): Try[CompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  16. def deflateDecompress(src: String, dest: String): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  17. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  20. def gzCompress(src: String, dest: String): Try[CompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  21. def gzDecompress(src: String, dest: String): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  22. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  23. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  24. def lz4Compress(src: String, dest: String): Try[CompressionStats]

    Permalink

    src

    file to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  25. def lz4Decompress(src: String, dest: String): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  26. def lzmaCompress(src: String, dest: String): Try[CompressionStats]

    Permalink

    src

    file to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  27. def lzmaDecompress(src: String, dest: String): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  28. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  30. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  31. def pack200Compress(src: String, dest: String): Try[CompressionStats]

    Permalink

    src

    File to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  32. def pack200Decompress(src: String, dest: String): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  33. def sevenZipCompress(src: List[String], dest: String): Try[CompressionStats]

    Permalink

    src

    File and folder to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  34. def sevenZipDecompress(src: String, dest: String, entries: Option[List[String]] = None): Try[DecompressionStats]

    Permalink

    src

    Compressed file

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  35. def snappyCompress(src: String, dest: String): Try[CompressionStats]

    Permalink

    src

    File to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  36. def snappyDecompress(src: String, dest: String): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  37. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  38. def tarCompress(src: List[String], dest: String): Try[CompressionStats]

    Permalink

    src

    File and folder to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  39. def tarDecompress(src: String, dest: String, entries: Option[List[String]] = None): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    entries

    If != None extract only these entries

    returns

    Statistics on decompression procedure

  40. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  41. def unzipString(src: Array[Byte], bufferSize: Int = 256): Try[Array[Byte]]

    Permalink

    src

    Compressed Array[Byte]

    bufferSize

    Optional buffer size

    returns

    Uncompressed Array[Byte]

  42. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. def writeStreamToFile(in: InputStream, dest: String): Try[Unit]

    Permalink
  46. def xzCompress(src: String, dest: String): Try[CompressionStats]

    Permalink

    src

    File to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  47. def xzDecompress(src: String, dest: String): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  48. def zStandardCompress(src: String, dest: String): Try[CompressionStats]

    Permalink

    src

    File to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  49. def zStandardDecompress(src: String, dest: String): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  50. def zipCompress(src: List[String], dest: String): Try[CompressionStats]

    Permalink

    src

    File and folder to compress

    dest

    Destination folder

    returns

    Statistics on compression procedure

  51. def zipDecompress(src: String, dest: String): Try[DecompressionStats]

    Permalink

    src

    File to decompress

    dest

    Destination folder

    returns

    Statistics on decompression procedure

  52. def zipDecompressEntry(src: String, entryName: String): Try[Array[Byte]]

    Permalink

    src

    Compressed file

    entryName

    The entry name to decompress

    returns

    Uncompressed Array[Byte]

  53. def zipEntries(src: String): Try[List[ZipEntry]]

    Permalink

    src

    Compressed file

    returns

    ZipEntry List

  54. def zipString(src: String, charSetName: String = "UTF-8"): Try[Array[Byte]]

    Permalink

    src

    String to compress

    returns

    compressed Array[Byte]

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped