List of utility methods to do Zip String
byte[] | zipStringToBytes(String input) Gzip the input string into a byte[]. ByteArrayOutputStream bos = new ByteArrayOutputStream(); BufferedOutputStream bufos = new BufferedOutputStream(new GZIPOutputStream(bos)); bufos.write(input.getBytes("UTF-8")); bufos.close(); byte[] retval = bos.toByteArray(); bos.close(); return retval; |
byte[] | zipText(String text) zip Text byte[] ba = null; GZIPOutputStream gzos = null; ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); if (baos != null) { gzos = new GZIPOutputStream(baos); byte[] stringAsBytes = (text).getBytes("UTF-8"); ... |