Class GZip


  • public final class GZip
    extends java.lang.Object
    This class implements stream compression using the GZip algorithm provided with the ZLib library.
    gzip (GNU zip) is a compression utility designed to be a replacement for compress. Its main advantages over compress are much better compression and freedom from patented algorithms. It has been adopted by the GNU project and is now relatively popular on the Internet.

    http://www.gzip.org/

    The ZLib library home page is

    http://www.zlib.net/

    Since:
    TotalCross 1.10
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int deflate​(Stream in, Stream out)
      Deflates the given stream 'in', writing the compressed data to the given stream 'out'.
      static int inflate​(Stream in, Stream out)
      Attempts to fully read the given stream 'in', inflate its content and write the uncompressed data to the given stream 'out'.
      static int inflate​(Stream in, Stream out, int sizeIn)
      Attempts to read the number of bytes specified by 'sizeIn' from the the given stream 'in', inflating and writing to the given stream 'out'.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • deflate

        public static int deflate​(Stream in,
                                  Stream out)
                           throws IOException
        Deflates the given stream 'in', writing the compressed data to the given stream 'out'.
        Parameters:
        in - Stream to be deflated.
        out - Deflated stream.
        Returns:
        Size of the deflated stream
        Throws:
        IOException
        Since:
        TotalCross 1.10
      • inflate

        public static int inflate​(Stream in,
                                  Stream out)
                           throws IOException,
                                  ZipException
        Attempts to fully read the given stream 'in', inflate its content and write the uncompressed data to the given stream 'out'.
        Parameters:
        in - Deflated input stream
        out - Inflated output stream
        Returns:
        Size of the inflated stream
        Throws:
        ZipException
        IOException
        Since:
        TotalCross 1.10
      • inflate

        public static int inflate​(Stream in,
                                  Stream out,
                                  int sizeIn)
                           throws IOException,
                                  ZipException
        Attempts to read the number of bytes specified by 'sizeIn' from the the given stream 'in', inflating and writing to the given stream 'out'. If 'sizeIn' is -1, it will attempt to fully read the stream.
        Parameters:
        in - Deflated input stream
        out - Inflated output stream
        sizeIn - How many bytes to read, or -1 to read until in's end.
        Returns:
        Size of the inflated stream
        Throws:
        IOException
        ZipException
        Since:
        TotalCross 1.10