Java Decompress Byte Array decompressBytes(byte bytess[][])

Here you can find the source of decompressBytes(byte bytess[][])

Description

decompress Bytes

License

Open Source License

Declaration

public static byte[] decompressBytes(byte bytess[][]) throws IOException 

Method Source Code

//package com.java2s;
/* This file is part of VoltDB.
 * Copyright (C) 2008-2011 VoltDB Inc.//from   w ww  . java 2s  . co  m
 *
 * VoltDB is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VoltDB is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with VoltDB.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.io.*;

import java.util.zip.*;

public class Main {
    public static byte[] decompressBytes(byte bytess[][]) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        for (byte bytes[] : bytess) {
            baos.write(bytes);
        }
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        baos = new ByteArrayOutputStream();
        GZIPInputStream gis = new GZIPInputStream(bais);
        byte bytes[] = new byte[1024 * 8];
        while (true) {
            int read = gis.read(bytes);
            if (read == -1) {
                break;
            }
            baos.write(bytes, 0, read);
        }
        return baos.toByteArray();
    }
}

Related

  1. decompress(final byte[] compressed)
  2. decompress(final DataInputStream input, final byte[] result, int offset, int length)
  3. decompressAndB64DecodeUTF8Bytes(byte[] b64EncodedCompressedBytes)
  4. decompressByte(byte[] decompress)
  5. decompressByteArray(byte[] compressedData)
  6. decompressBytes(byte[] input)
  7. decompressByZLIB(byte[] compressedBytes)
  8. decompressData(byte[] compressedInput)
  9. decompressFolderByteArray(byte[] folderAsCompressedArray, File unzippedLocation)