title: How to compress a String in Android
body: <p>I am trying to compress a large string object. This is what i tried, but i am unable to understand how to get compressed data, and how to define different type of compression tools.</p>
  
  <p>This is what i got from Android docs.</p>
  
  <pre><code>        byte[] input = jsonArray.getBytes("UTF-8");
          byte[] output = new byte[100];
  
          Deflater compresser = new Deflater();
          compresser.setInput(input);
          compresser.finish();
          int compressedDataLength = compresser.deflate(output);
          compresser.end();
  </code></pre>
  
  <p><code>compresser.deflate(output)</code> gives me a <code>int</code> number, <code>100</code></p>
  
  <p>but i am unable to understand which method will give me the compressed output that i can send to service. </p>