code: public byte[] writeToByteArray() throws IOException {
          final InputStream stream = getInputStream();
          try {
              return ByteStreams.toByteArray(stream);
          } finally {
              stream.close();
          }
      }
docs: Writes all the binary data of this representation to a {@code byte[]} object. Conversion
  from character to byte data, if required, is performed according to the charset specified
  by the MIME type metadata property ({@link NIE#MIME_TYPE}). If some data has been already
  read via {@code getInputStream()} or {@code getReaer()}, it will not be returned in the
  result.
  
  @return a byte array with the binary content of this representation
  @throws IOException
  in case access to binary data fails