Code example for Deflater

Methods: setLevel

0
            upload_str = upload_str.trim();
 
            ByteArrayOutputStream baos = new ByteArrayOutputStream(10000);
            GZIPOutputStream gzos = new GZIPOutputStream(baos) {
                { 
                    def.setLevel(Deflater.BEST_COMPRESSION);
                } 
            }; 
            gzos.write(upload_str.getBytes("UTF-8"));
            gzos.close();
 
            byte[] the_gzipped_bytes = baos.toByteArray();
            HttpResponse response = postBytes(the_gzipped_bytes, 0);
 
      //      msLog(httpResponseToString(response)); 
            recoveryFile.delete();
 
        } catch (Exception e) {
        //    msLog("Exception while uploading recovery file"); 
        } 
    }