code: public static byte[] readAsBytes(InputStream inputStream) throws IOException {
          int cnt = 0;
          byte[] buffer = new byte[BUFFER_SIZE];
          InputStream is = new BufferedInputStream(inputStream);
          try {
              ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
              cnt = is.read(buffer);
              while (cnt != -1) {
                  outputStream.write(buffer, 0, cnt);
                  cnt = is.read(buffer);
              }
              return outputStream.toByteArray();
          } finally {
              safeClose(is);
          }
      }
docs: Reads the inputStream and returns a byte array with all the information
  
  @param inputStream The inputStream to be read
  @return A byte array with all the inputStream's information
  @throws IOException The exception thrown when an error reading the inputStream happens