public static void main(String[] args)
        {
            try
            {
                java.io.ByteArrayOutputStream outJ = new java.io.ByteArrayOutputStream();
                ZOutputStream zOut  = new ZOutputStream(outJ, JZlib.Z_BEST_COMPRESSION);
                String        hello = "Hello World!";
                //java.io.ObjectOutputStream objOut = new java.io.ObjectOutputStream(zOut);
                //objOut.writeObject(hello);
                outJ.write(hello.getBytes());
                zOut.close();

                java.io.ByteArrayInputStream inJ = new java.io.ByteArrayInputStream(outJ.toByteArray());
                ZInputStream zIn = new ZInputStream(inJ);
                //java.io.ObjectInputStream objIn=new java.io.ObjectInputStream(zIn);
                byte[] buffer = new byte[hello.length()];
                inJ.read(buffer);
                java.lang.SystemJ.outJ.println(new java.lang.StringJ(buffer).ToString() /*objIn.readObject()*/);
            }
            catch (java.lang.Exception e)
            {
                e.printStackTrace();
            }
        }
        public static void main(String[] args)
        {
            try
            {
                java.io.ByteArrayOutputStream outJ = new java.io.ByteArrayOutputStream();
                ZOutputStream zOut = new ZOutputStream(outJ, JZlib.Z_BEST_COMPRESSION);
                String hello = "Hello World!";
                //java.io.ObjectOutputStream objOut = new java.io.ObjectOutputStream(zOut);
                //objOut.writeObject(hello);
                outJ.write(hello.getBytes());
                zOut.close();

                java.io.ByteArrayInputStream inJ = new java.io.ByteArrayInputStream(outJ.toByteArray());
                ZInputStream zIn = new ZInputStream(inJ);
                //java.io.ObjectInputStream objIn=new java.io.ObjectInputStream(zIn);
                byte[] buffer = new byte[hello.length()];
                inJ.read(buffer);
                java.lang.SystemJ.outJ.println(new java.lang.StringJ(buffer).ToString() /*objIn.readObject()*/);
            }
            catch (java.lang.Exception e)
            {
                e.printStackTrace();
            }
        }
        public override int read(byte[] buffer, int start, int length) //throws IOException
        {
            if (closed)
            {
                throw new java.io.IOException("The stream is closed");
            }
            if (inf.finished() || current == null)
            {
                return(-1);
            }

            // avoid int overflow, check null buffer
            if (start <= buffer.Length && length >= 0 && start >= 0 &&
                buffer.Length - start >= length)
            {
                ZipUtil.checkRequestedFeatures(current);
                if (!supportsDataDescriptorFor(current))
                {
                    throw new UnsupportedZipFeatureException(Feature.DATA_DESCRIPTOR, current);
                }

                if (current.getMethod() == ZipArchiveOutputStream.STORED)
                {
                    if (hasDataDescriptor)
                    {
                        if (lastStoredEntry == null)
                        {
                            readStoredEntry();
                        }
                        return(lastStoredEntry.read(buffer, start, length));
                    }

                    int csize = (int)current.getSize();
                    if (readBytesOfEntry >= csize)
                    {
                        return(-1);
                    }
                    if (offsetInBuffer >= lengthOfLastRead)
                    {
                        offsetInBuffer = 0;
                        if ((lengthOfLastRead = inJ.read(buf)) == -1)
                        {
                            return(-1);
                        }
                        count(lengthOfLastRead);
                        bytesReadFromStream += lengthOfLastRead;
                    }
                    int toRead = length > lengthOfLastRead
                        ? lengthOfLastRead - offsetInBuffer
                        : length;
                    if ((csize - readBytesOfEntry) < toRead)
                    {
                        toRead = csize - readBytesOfEntry;
                    }
                    java.lang.SystemJ.arraycopy(buf, offsetInBuffer, buffer, start, toRead);
                    offsetInBuffer   += toRead;
                    readBytesOfEntry += toRead;
                    crc.update(buffer, start, toRead);
                    return(toRead);
                }

                if (inf.needsInput())
                {
                    fill();
                    if (lengthOfLastRead > 0)
                    {
                        bytesReadFromStream += lengthOfLastRead;
                    }
                }
                int read = 0;
                try {
                    read = inf.inflate(buffer, start, length);
                } catch (java.util.zip.DataFormatException e) {
                    throw new java.util.zip.ZipException(e.getMessage());
                }
                if (read == 0)
                {
                    if (inf.finished())
                    {
                        return(-1);
                    }
                    else if (lengthOfLastRead == -1)
                    {
                        throw new java.io.IOException("Truncated ZIP file");
                    }
                }
                crc.update(buffer, start, read);
                return(read);
            }
            throw new java.lang.ArrayIndexOutOfBoundsException();
        }