The list of methods to do GZip are organized into topic(s).
byte[]
gzip(final T o) passed object convert to gziped byte array.
if (o == null) {
return null;
try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final GZIPOutputStream gzip = new GZIPOutputStream(baos);) {
gzip.write(MAPPER.writeValueAsBytes(o));
;
gzip.close();
...
byte[]
gzip(String s) gzip
ByteArrayOutputStream bos = new ByteArrayOutputStream();
GZIPOutputStream gzip = new GZIPOutputStream(bos);
OutputStreamWriter osw = new OutputStreamWriter(gzip, StandardCharsets.UTF_8);
osw.write(s);
osw.close();
return bos.toByteArray();
String
gzip(String str) gzip
if (null == str || str.length() < 1) {
return str;
ByteArrayOutputStream out = new ByteArrayOutputStream();
try (GZIPOutputStream gzip = new GZIPOutputStream(out)) {
gzip.write(str.getBytes());
return out.toString(CHARSET_ZIP.name());
...
BufferedReader
gzipFileReader(String file) gzip File Reader
return new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(file)), UTF8));