Android Utililty Methods Zip Byte Array

List of utility methods to do Zip Byte Array

Description

The list of methods to do Zip Byte Array are organized into topic(s).

Method

byte[]zipByte(byte[] data)
zip Byte
Deflater compresser = new Deflater();
compresser.reset();
compresser.setInput(data);
compresser.finish();
byte result[] = new byte[0];
ByteArrayOutputStream o = new ByteArrayOutputStream(1);
try {
    byte[] buf = new byte[CacheSize];
...
booleanzip(byte[] data, String fileName, String path)
zip
String TAG = "ZipUtil : ";
File pathFile = new File(path);
pathFile.mkdirs();
String zipName = path + "\\" + fileName + ".zip";
File file = new File(zipName);
if (!file.exists()) {
    file.createNewFile();
FileOutputStream os = null;
ZipOutputStream out = null;
try {
    os = new FileOutputStream(file);
    out = new ZipOutputStream(os);
    String tmp = new String(fileName.getBytes("UTF-8"));
    tmp = unicodeEscape(tmp);
    ZipEntry entry = new ZipEntry(tmp + ".xml");
    out.putNextEntry(entry);
    out.write(data);
    out.flush();
    out.closeEntry();
    out.flush();
    out.finish();
} catch (Exception e) {
    e.printStackTrace();
    System.err.println(TAG + " Error " + e.toString());
    throw e;
} finally {
    out.close();
    os.close();
return true;