Java Zip Byte Array zip(byte[] datas)

Here you can find the source of zip(byte[] datas)

Description

zip

License

Apache License

Declaration

public static byte[] zip(byte[] datas) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.DeflaterOutputStream;

public class Main {
    public static byte[] zip(byte[] datas) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        DeflaterOutputStream dos = new DeflaterOutputStream(out);
        dos.write(datas);/*from ww w  .  j  a  va2 s.  c  o  m*/
        dos.close();
        return out.toByteArray();
    }
}

Related

  1. doZip(byte[] data)
  2. zip(byte[] bytes)
  3. zip(byte[] data)
  4. zip(byte[] in)
  5. zip(byte[] input)
  6. zip(byte[] input)
  7. zip(byte[] source)