List of usage examples for java.util.zip Deflater getBytesWritten
public long getBytesWritten()
From source file:com.moesol.keys.EncodeUidsTest.java
public void testCompress() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 10000; i++) { UUID id = UUID.randomUUID(); sb.append(id);/*from w ww. j av a 2 s . c o m*/ sb.append(','); } String result = sb.toString(); // System.out.println("val=" + result); Deflater deflate = new Deflater(); try { byte[] compressed = new byte[512000]; deflate.setInput(result.getBytes()); deflate.finish(); System.out.printf("in=%d out=%d%n", deflate.getBytesRead(), deflate.getBytesWritten()); deflate.deflate(compressed); System.out.printf("in=%d out=%d%n", deflate.getBytesRead(), deflate.getBytesWritten()); } finally { deflate.end(); } }