docs: public static byte[] readStream(InputStream stream) {
          ByteArrayOutputStream ostream = null;
          try {
              ostream = new ByteArrayOutputStream(stream.available());
              byte data[] = new byte[BUFFER_SIZE];
              int count;
              while ((count = stream.read(data)) != -1) {
                  ostream.write(data, 0, count);
              }
              return ostream.toByteArray();
          } catch (IOException e) {
              return null;
          } finally {
              if (stream != null) {
                  try {
                      stream.close();
                  } catch (IOException e) {
                  }
              }
  
              if (ostream != null) {
                  try {
                      ostream.close();
                  } catch (IOException e) {
                  }
              }
          }
      }