Class DittoAttachmentToken

java.lang.Object
com.ditto.java.DittoAttachmentToken

public final class DittoAttachmentToken extends Object

Represents a reference token for a specific attachment in the Ditto store.

An attachment token serves as a handle to an attachment and contains metadata about it, including its unique identifier, size, and custom metadata. You can pass this token to DittoStore.fetchAttachment(DittoAttachmentToken) to download the attachment data from remote peers.

Attachment tokens are typically obtained from document properties that reference attachments.

  • Method Details

    • getId

      public @NonNull String getId()
      Returns the attachment's unique identifier.
      Returns:
      the attachment ID as a string.
    • getLength

      public @NonNull DittoULong getLength()
      Returns the length (size) of the attachment in bytes.
      Returns:
      the attachment size as an unsigned long.
    • getMetadata

      public @NonNull DittoCborSerializable.Dictionary getMetadata()

      Returns the attachment's metadata.

      Metadata is stored as a CBOR dictionary and can contain custom key-value pairs associated with the attachment, such as content type, filename, or other properties.

      Returns:
      the metadata dictionary.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object