code: public static byte[] inputStreamToBytes(InputStream in)
      {
          try
          {
              FastByteArrayOutputStream out = new FastByteArrayOutputStream(16384);
              transfer(in, out);
              return Arrays.copyOf(out.buffer, out.size);
          }
          catch (Exception e)
          {
              return null;
          }
      }
docs: Convert InputStream contents to a byte[].
  Will return null on error.  Only use this API if you know that the stream length will be
  relatively small.