List of usage examples for java.util.zip ZipException printStackTrace
public void printStackTrace(PrintStream s)
From source file:ZipDemo.java
public static final String uncompress(final byte[] compressed) throws IOException { String uncompressed = ""; try {//from w w w.ja va 2s . c o m ByteArrayInputStream bais = new ByteArrayInputStream(compressed); GZIPInputStream zis = new GZIPInputStream(bais); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int numBytesRead = 0; byte[] tempBytes = new byte[DEFAULT_BUFFER_SIZE]; while ((numBytesRead = zis.read(tempBytes, 0, tempBytes.length)) != -1) { baos.write(tempBytes, 0, numBytesRead); } uncompressed = new String(baos.toByteArray()); } catch (ZipException e) { e.printStackTrace(System.err); } return uncompressed; }