Package totalcross.util.zip
Class GZip
- java.lang.Object
-
- totalcross.util.zip.GZip
-
public final class GZip extends java.lang.ObjectThis class implements stream compression using the GZip algorithm provided with the ZLib library.
The ZLib library home page isgzip (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.
- Since:
- TotalCross 1.10
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intdeflate(Stream in, Stream out)Deflates the given stream 'in', writing the compressed data to the given stream 'out'.static intinflate(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 intinflate(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'.
-
-
-
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 streamout- Inflated output stream- Returns:
- Size of the inflated stream
- Throws:
ZipExceptionIOException- 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 streamout- Inflated output streamsizeIn- How many bytes to read, or -1 to read untilin's end.- Returns:
- Size of the inflated stream
- Throws:
IOExceptionZipException- Since:
- TotalCross 1.10
-
-