Java examples for java.lang:byte Array Compress
Decompress String and return a String
//package com.java2s; import java.io.*; import java.util.zip.*; import sun.misc.*; public class Main { public static void main(String[] argv) throws Exception { String encdata = "java2s.com"; System.out.println(DeCompress(encdata)); }// w ww . j av a 2s .c o m public static String DeCompress(String encdata) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); InflaterOutputStream zos = new InflaterOutputStream(bos); zos.write(new BASE64Decoder().decodeBuffer(encdata)); zos.close(); return new String(bos.toByteArray()); } catch (Exception ex) { ex.printStackTrace(); return "?"; } } }