test_gzip

来源:互联网 发布:时时彩开奖源码 编辑:程序博客网 时间:2024/06/05 22:52
publicstaticbyte[] unGZip(byte[] bContent)
{

byte[] data =newbyte[MAXLENGTH];
try
{
ByteArrayInputStreamin=newByteArrayInputStream(bContent);
GZIPInputStream pIn =newGZIPInputStream(in);
DataInputStream objIn =newDataInputStream(pIn);

int len =0;
int count =0;
while((count= objIn.read(data, len, len+ BUFFERSIZE))!=-1)
{
len= len+ count;
}

byte[] trueData =newbyte[len];
System.arraycopy(data,0, trueData,0, len);

objIn.close();
pIn.close();
in.close();

return trueData;

}
catch(Exception e)
{
e.printStackTrace();
}
returnnull;
}
0 0