Here you can find the source of getGzipByteArrayOutputStream(String domJson)
Parameter | Description |
---|---|
domJson | JSON as string to be gzipped |
public static byte[] getGzipByteArrayOutputStream(String domJson)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.zip.GZIPOutputStream; public class Main { /**// w w w. j a va 2 s . c o m * Get gzip byte array output stream byte [ ]. * @param domJson JSON as string to be gzipped * @return byte[] of the gzipped string */ public static byte[] getGzipByteArrayOutputStream(String domJson) { ByteArrayOutputStream resultStream = new ByteArrayOutputStream(); try { GZIPOutputStream gzip = new GZIPOutputStream(resultStream); gzip.write(domJson.getBytes()); gzip.close(); } catch (IOException e) { e.printStackTrace(); } return resultStream.toByteArray(); } }