集册 Java实例教程 压缩字节数组gzip

压缩字节数组gzip

欢马劈雪     最近更新时间:2020-01-02 10:19:05

487
压缩字节数组gzip


import java.io.ByteArrayInputStream;
/* from 
NowJava.com*/

import java.io.ByteArrayOutputStream;

import java.io.IOException;

import java.util.zip.GZIPInputStream;

import java.util.zip.GZIPOutputStream;


public class Main{

    /**

     * Compresses a byte array

     */

    public static byte[] uncompress(byte[] theBytes) throws IOException {

        ByteArrayInputStream bis = new ByteArrayInputStream(theBytes);

        GZIPInputStream gos = new GZIPInputStream(bis);

        ByteArrayOutputStream bos = 
展开阅读全文