Interface BlobResourceContents

All Superinterfaces:
HasMeta, ResourceContents

@Immutable public non-sealed interface BlobResourceContents extends ResourceContents
Binary resource contents, encoded as a base64 string.

Used when a resource cannot be represented as text. The uri identifies the resource, mimeType describes the binary format, and blob carries the base64-encoded data.

  • Method Details

    • uri

      @Parameter(order=1) String uri()
      Description copied from interface: ResourceContents
      Returns the resource URI.
      Specified by:
      uri in interface ResourceContents
      Returns:
      the resource identifier
    • mimeType

      @Parameter(order=2) @Nullable String mimeType()
      Description copied from interface: ResourceContents
      Returns the MIME type of the resource content, or null if unspecified.
      Specified by:
      mimeType in interface ResourceContents
      Returns:
      the MIME type, or null
    • blob

      @Parameter(order=3) @Redacted String blob()
      Returns the base64-encoded binary content.
      Returns:
      the blob data as a base64 string
    • meta

      @Parameter(order=4) @Nullable Map<String,Object> meta()
      Description copied from interface: HasMeta
      Returns the optional metadata map for protocol extensions.
      Specified by:
      meta in interface HasMeta
      Returns:
      the metadata map, or null if none
    • check

      @Check default void check()
      Validates that required fields are not blank.
      Throws:
      IllegalArgumentException - if uri or blob is blank
    • of

      static BlobResourceContents of(String uri, String blob, @Nullable String mimeType)
      Creates binary resource contents with no _meta.
      Parameters:
      uri - the resource URI
      blob - the base64-encoded binary content
      mimeType - the content's MIME type, or null if unspecified
      Returns:
      a new blob resource contents
    • of

      static BlobResourceContents of(String uri, String blob, @Nullable String mimeType, @Nullable Map<String,Object> meta)
      Creates binary resource contents.
      Parameters:
      uri - the resource URI
      blob - the base64-encoded binary content
      mimeType - the content's MIME type, or null if unspecified
      meta - the _meta entries, or null if none
      Returns:
      a new blob resource contents
    • builder

      static BlobResourceContents.Builder builder()
      Creates a new builder for constructing BlobResourceContents instances.
      Returns:
      a new builder