Java Deflate Byte Array deflate(byte[] bytes)

Here you can find the source of deflate(byte[] bytes)

Description

deflate

License

Open Source License

Declaration

public static byte[] deflate(byte[] bytes) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.*;

import java.util.zip.*;

public class Main {
    public static byte[] deflate(byte[] bytes) throws IOException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DeflaterOutputStream dos = new DeflaterOutputStream(bos, new Deflater(Deflater.DEFAULT_COMPRESSION, true));
        dos.write(bytes);/*from w  w  w. j  a  v a  2  s  .co m*/
        dos.close();
        return bos.toByteArray();
    }
}

Related

  1. deflate(byte[] array)
  2. deflate(byte[] buf)
  3. deflate(byte[] data)
  4. deflate(byte[] data)
  5. deflate(byte[] data)
  6. deflate(byte[] data, byte[] dictionary)