Interface FileContent

All Known Implementing Classes:
FileWithBytes, FileWithUri

public sealed interface FileContent permits FileWithBytes, FileWithUri
Sealed interface representing file content in the A2A Protocol.

FileContent provides a polymorphic abstraction for file data, allowing files to be represented either as embedded binary content or as URI references. This flexibility enables different strategies for file transmission based on size, security, and accessibility requirements.

The sealed interface permits only two implementations:

  • FileWithBytes - File content embedded as base64-encoded bytes (for small files or inline data)
  • FileWithUri - File content referenced by URI (for large files or external resources)

Both implementations must provide:

  • MIME type - Describes the file format (e.g., "image/png", "application/pdf")
  • File name - The original or display name for the file
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the MIME type of the file content.
    Returns the file name.
  • Method Details

    • mimeType

      String mimeType()
      Returns the MIME type of the file content.
      Returns:
      the MIME type (e.g., "image/png", "text/plain", "application/json")
    • name

      String name()
      Returns the file name.
      Returns:
      the file name (e.g., "document.pdf", "image.jpg")