public static byte[] inflateByteArray(byte[] input) {
    try {
      ByteArrayInputStream bos = new ByteArrayInputStream(input);
      InflaterInputStream in = new InflaterInputStream(bos);

      byte[] uncompressedData = ERXFileUtilities.bytesFromInputStream(in);
      return uncompressedData;
    } catch (IOException e) {
      return null;
    }
  }
 /**
  * Returns an NSData containing the gzipped version of the given input stream.
  *
  * @param input the input stream to compress
  * @param length the length of the input stream
  * @return gzipped NSData
  */
 public static NSData gzipInputStreamAsNSData(InputStream input, int length) {
   try {
     ERXRefByteArrayOutputStream bos = new ERXRefByteArrayOutputStream(length);
     if (input != null) {
       GZIPOutputStream out = new GZIPOutputStream(bos);
       try {
         ERXFileUtilities.writeInputStreamToOutputStream(input, true, out, false);
       } finally {
         try {
           out.finish();
         } finally {
           out.close();
         }
       }
     }
     return bos.toNSData();
   } catch (IOException e) {
     log.error("Failed to gzip byte array.", e);
     return null;
   }
 }