Code example for SequenceInputStream

0
            InputStream rawis = new ByteArrayInputStream( data);
            if (compression == 0) return rawis;
            else { 
                // Hacky, inflate using a sequence of input streams that returns 1 byte more than the actual length of the data.   
                // This extra dummy byte is required by InflaterInputStream when the data doesn't have the header and crc fields (as it is in zip files).  
                return new InflaterInputStream( new SequenceInputStream(rawis, new ByteArrayInputStream(new byte[1])), new Inflater( true));
            } 
        } 
         
        ZioEntryInputStream dataStream;
        dataStream = new ZioEntryInputStream(this);
        if (monitorStream != null) dataStream.setMonitorStream( monitorStream);
        if (compression != 0)  {
            // Note: When using nowrap=true with Inflater it is also necessary to provide  
            // an extra "dummy" byte as input. This is required by the ZLIB native library  
            // in order to support certain optimizations. 
            dataStream.setReturnDummyByte(true);
            return new InflaterInputStream( dataStream, new Inflater( true));
        } 
        else return dataStream;
    }