code: public static Attachment fromBinaryInputStream( InputStream inputStream, MediaType mediaType ) throws IOException {
          return fromBinaryBytes( ByteStreams.toByteArray( inputStream ), mediaType );
      }
docs: Creates an attachment from a binary input stream.
  The content of the stream will be transformed into a Base64 encoded string
  @throws IOException if an I/O error occurs
  @throws java.lang.IllegalArgumentException if mediaType is not binary