code: private byte[] readStreamCompressed(InputStream stream) throws IOException
      {
          ByteArrayOutputStream bao    = new ByteArrayOutputStream();
          GZIPOutputStream      gos    = new GZIPOutputStream(bao);
          OutputStreamWriter    output = new OutputStreamWriter(gos);
          BufferedReader        input  = new BufferedReader(new InputStreamReader(stream));
          String                line;
  
          while ((line = input.readLine()) != null)
          {
              output.write(line);
              output.write('\n');
          }
          input.close();
          stream.close();
          output.close();
          gos.close();
          bao.close();
          return bao.toByteArray();
      }
docs: Reads the given text stream and compressed its content.
  
  @param stream The input stream
  @return A byte array containing the GZIP-compressed content of the stream
  @throws IOException If an error ocurred