I'm who I am .
压缩GZip
上一篇 /
下一篇 2015-01-15 12:56:26
/ 个人分类:java
//----------------------------gZip--------------------------------------------------------
/***
* 压缩GZip
*
* @param data
* @return
*/
public static byte[] gZip(byte[] data) {
System.out.println("压缩中。。。");
byte[] b = null;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
GZIPOutputStream gzip = new GZIPOutputStream(bos);
gzip.write(data);
gzip.finish();
gzip.close();
b = bos.toByteArray();
bos.close();
} catch (Exception ex) {
ex.printStackTrace();
}
System.out.println("压缩完成。。。");
return b;
}
收藏
举报
TAG: