2009-08-13 33 views

回答

3

,看一下GZIPInputStream

GZIPInputStream gzipInputStream = new GZIPInputStream(new FileInputStream(inFilename)); 
byte[] buf = new byte[1024]; 
int len; 
while ((len = gzipInputStream.read(buf)) > 0) { 
    // buf contains uncompressed data  
} 
0

把數據放到一個ByteArrayInputStream,那麼你應該能夠將其與GZipInputStream解碼。

要從字符串中獲取字節,請嘗試getBytes("ISO-8859-1")。這種編碼不會改變傳入的字節。