Code example for GZIPOutputStream

Methods: close

0
		return baos.toByteArray();
	} 
 
	public static byte[] compress(InputStream is) throws Exception {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		GZIPOutputStream gzos = new GZIPOutputStream(baos);
		IOUtils.copy(is, gzos);
		 
		gzos.close();
		 
		return baos.toByteArray();
	} 
 
	public static byte[] decompress(byte[] input) throws Exception {
		return decompress(new ByteArrayInputStream(input));
	} 
	 
	public static byte[] compress(byte[] input) throws Exception {
		return compress(new ByteArrayInputStream(input));
	}