Android Byte Array Unzip deflate(byte[] paramArrayOfByte, int paramInt1, int paramInt2)

Here you can find the source of deflate(byte[] paramArrayOfByte, int paramInt1, int paramInt2)

Description

deflate

Declaration

public static byte[] deflate(byte[] paramArrayOfByte, int paramInt1,
            int paramInt2) 

Method Source Code

//package com.java2s;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;

public class Main {
    public static byte[] deflate(byte[] paramArrayOfByte) {
        return deflate(paramArrayOfByte, 0, paramArrayOfByte.length);
    }/*  w  ww  .  ja  va2 s.co  m*/

    public static byte[] deflate(byte[] paramArrayOfByte, int paramInt1,
            int paramInt2) {
        ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
        DeflaterOutputStream localDeflaterOutputStream = new DeflaterOutputStream(
                localByteArrayOutputStream, new Deflater());
        try {
            localDeflaterOutputStream.write(paramArrayOfByte, paramInt1,
                    paramInt2);
            localDeflaterOutputStream.close();
            return localByteArrayOutputStream.toByteArray();
        } catch (IOException localIOException) {
            throw new IllegalStateException("ByteArrayOutputStream threw ",
                    localIOException);
        }
    }
}

Related

  1. decompress(byte[] data)
  2. decompress(byte[] data)
  3. decompress(byte[] paramArrayOfByte)
  4. deflate(byte[] paramArrayOfByte)