Interface BinaryData

All Known Implementing Classes:
ByteArrayBinaryData

@JsonpDeserializable public interface BinaryData
Binary data with an associated content type.
  • Field Details

  • Method Details

    • contentType

      String contentType()
      The content type.
    • writeTo

      void writeTo(OutputStream out) throws IOException
      Write this data to an output stream.
      Throws:
      IOException
    • asByteBuffer

      ByteBuffer asByteBuffer()
      Return this data as a ByteBuffer
    • size

      long size()
      Get the estimated size in bytes of the data.
      Returns:
      the estimated size, or -1 if the value cannot be estimated or if the data has already been consumed.
    • of

      static BinaryData of(Object value, JsonpMapper mapper)
      Create a BinaryData from a value and a JSON mapper. The binary content is the result of serializing value with mapper. Returns null if value is null.

      Note that the result's content-type can be different from "application/json" if the JSON mapper is setup to produce other representations such as CBOR or SMILE.

    • of

      static BinaryData of(byte[] bytes, String contentType)
    • of

      static BinaryData of(byte[] value, int offset, int length, String contentType)