Package java.util.zip

Examples of java.util.zip.Deflater.end()


     
      capacity += byte_count;
     
    } while (byte_count != 0);
   
    compressor.end();
   
    ByteBuffer outputData = Misc.getByteBuffer(capacity);
   
    for(ByteBuffer buffer : vector) {
      buffer.position(0);
View Full Code Here


        Deflater deflater = new Deflater();

        deflater.setInput(testString.getBytes());
        deflater.finish();
        deflater.deflate(buffer);
        deflater.end();

        assertEquals(testString, Tools.decompressZlib(buffer));
    }

    @Test
View Full Code Here

      outSize += size;
      offset += size;
      // if we run out of space in the out buffer, use the overflow
      if (out.remaining() == 0) {
        if (overflow == null) {
          deflater.end();
          return false;
        }
        out = overflow;
        offset = out.arrayOffset() + out.position();
      }
View Full Code Here

        }
        out = overflow;
        offset = out.arrayOffset() + out.position();
      }
    }
    deflater.end();
    return length > outSize;
  }

  @Override
  public void decompress(ByteBuffer in, ByteBuffer out) throws IOException {
View Full Code Here

            int totalOut = compressor.deflate(compressed);
            byte[] zipsrc = new byte[totalOut];

            System.arraycopy(compressed, 0, zipsrc, 0, totalOut);
            compressor.end();

            return CODEC.encode(zipsrc);
        } catch (Exception e) {
            throw new FacesException("Error encode resource data", e);
        }
View Full Code Here

    }

    public void destroy() {
        for(int i=0; i < deflater_pool.length; i++) {
            Deflater deflater=deflater_pool[i];
            deflater.end();
        }
        for(int i=0; i < inflater_pool.length; i++) {
            Inflater inflater=inflater_pool[i];
            inflater.end();
        }
View Full Code Here

                oos.writeTo(dos);
                dos.close(); // note: closes this, too!
            } catch (final IllegalArgumentException e) {
                // discard further un-compressed data
                // -> if not called, there may be memory leaks!
                def.end();
                // could not make the value smaller than originally
                // -> reset to starting count, write uncompressed
                super.count = startCount;
                try {
                    oos.writeTo(this);
View Full Code Here

      compressor.setInput(src);
      compressor.finish();
      int totalOut = compressor.deflate(compressed);
      byte[] zipsrc = new byte[totalOut];
      System.arraycopy(compressed, 0, zipsrc, 0, totalOut);
      compressor.end();
      return codec.encode(zipsrc);
    } catch (Exception e) {
      throw new FacesException("Error encode resource data", e);
    }
  }
View Full Code Here

        while (!compressor.finished()) {
            int count = compressor.deflate(buf);
            bos.write(buf, 0, count);
        }
        bos.close();
        compressor.end();
        return bos.toByteArray();
    }

    public static byte[] decompress(byte[] compressedData) throws IOException {
        Inflater inflater = new Inflater();
View Full Code Here

        byte[] buf = new byte[1024];
        while (!deflater.finished()) {
            int count = deflater.deflate(buf);
            out.write(buf, 0, count);
        }
        deflater.end();
    }

    static void decompress(byte[] compressedData, DataOutput out) throws IOException {
        Inflater inflater = new Inflater();
        inflater.setInput(compressedData);
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.