Package java.util.zip

Examples of java.util.zip.GZIPInputStream.available()


   
    /* Inflate deflated data. */
    try{
      gzipInputStream = new GZIPInputStream(byteArrayInputStream);
     
      while(gzipInputStream.available() > 0){
        if(!buffer.hasRemaining()){
          nbytes += buffer.position();
         
          buffer.flip();
          buffers.add(buffer);
View Full Code Here


    private static byte[] decompressData(final byte[] content) throws IOException, DataFormatException {
        final ByteArrayInputStream bytein = new java.io.ByteArrayInputStream(content);
        final ByteArrayOutputStream bos = new ByteArrayOutputStream(content.length);
        final GZIPInputStream gzin = new GZIPInputStream(bytein);
        byte[] buf = new byte[1024];
        while (gzin.available() != 0) {
            int count = gzin.read(buf);
            if (count > 0) {
                bos.write(buf, 0, count);
            }
        }
View Full Code Here

    } );

    ByteBuf uncompressed = Unpooled.buffer( stream.readableBytes() );
    byte tmp[] = new byte[1024];
    while (gzReader.available() != 0)
    {
      int bytes = gzReader.read( tmp );
      if ( bytes > 0 )
        uncompressed.writeBytes( tmp, 0, bytes );
    }
View Full Code Here

  public static byte[] uncompress(byte[] src) throws IOException {
    byte[] buffer = new byte[1024]; // 1k buffer
    ByteArrayInputStream bin = new ByteArrayInputStream(src);
    GZIPInputStream gzipIn = new GZIPInputStream(bin);
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    while (gzipIn.available() > 0) {
      int len = gzipIn.read(buffer);
      if (len <= 0) break;
      if (len < buffer.length) {
        bout.write(buffer, 0, len);
      } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.