Interface IBase64BinaryItem

All Superinterfaces:
IAnyAtomicItem, IAtomicValuedItem, dev.metaschema.core.metapath.item.atomic.impl.IBinaryItem, ICollectionValue, IItem

public interface IBase64BinaryItem extends dev.metaschema.core.metapath.item.atomic.impl.IBinaryItem
An atomic Metapath item containing a Base64 encoded data value.
  • Method Details

    • type

      @NonNull static IAtomicOrUnionType<IBase64BinaryItem> type()
      Get the type information for this item.
      Returns:
      the type information
    • getType

      Description copied from interface: IItem
      Get the type information for the item.
      Specified by:
      getType in interface IItem
      Returns:
      the item's type information
    • encode

      static IBase64BinaryItem encode(@NonNull IStringItem text)
      Base64 encode the provided string.

      The provided string is first encoded as a stream of UTF8 bytes.

      Parameters:
      text - the string to encode
      Returns:
      a base64 item representing the encoded data
    • encode

      static IBase64BinaryItem encode(@NonNull String text)
      Base64 encode the provided string.

      The provided string is first encoded as a stream of UTF8 bytes.

      Parameters:
      text - the string to encode
      Returns:
      a base64 item representing the encoded data
    • encode

      @NonNull static IBase64BinaryItem encode(@NonNull byte[] bytes)
      Base64 encode the provided bytes.
      Parameters:
      bytes - the bytes to encode
      Returns:
      a base64 item representing the encoded data
    • encode

      @NonNull static IBase64BinaryItem encode(@NonNull ByteBuffer buffer)
      Base64 encode the bytes from the provided buffer.
      Parameters:
      buffer - the bytes to encode
      Returns:
      a base64 item representing the encoded data
    • decode

      default IHexBinaryItem decode()
      Base64 decode this item as a new hex binary item.
      Returns:
      a new hex binary item containing the decoded bytes
    • decodeAsString

      default IStringItem decodeAsString()
      Base64 decode this item as a string.
      Returns:
      a new string item containing the decoded text
    • valueOf

      @NonNull static IBase64BinaryItem valueOf(@NonNull String value)
      Construct a new base64 byte sequence item using the provided base64 encoded string value.
      Parameters:
      value - a string representing base64 encoded data
      Returns:
      the new item
      Throws:
      InvalidTypeMetapathException - if the provided string is not a valid Base64 character sequence
    • valueOf

      @NonNull static IBase64BinaryItem valueOf(@NonNull ByteBuffer buffer)
      Construct a new URI base64 encoded byte sequence using the provided ByteBuffer value.

      The provided buffer will be managed by this instance. Make a copy of the buffer to ensure that the position, limit, and mark of the original are not affect by this.

      Parameters:
      buffer - a byte buffer
      Returns:
      the new item
    • cast

      @NonNull static IBase64BinaryItem cast(@NonNull IAnyAtomicItem item)
      Cast the provided type to this item type.
      Parameters:
      item - the item to cast
      Returns:
      the original item if it is already this type, otherwise a new item cast to this type
      Throws:
      InvalidValueForCastFunctionException - if the provided item cannot be cast to this type
    • castAsType

      default IBase64BinaryItem castAsType(IAnyAtomicItem item)
      Description copied from interface: IAnyAtomicItem
      Cast the provided item to be the same type as this item.
      Specified by:
      castAsType in interface IAnyAtomicItem
      Parameters:
      item - the item to cast
      Returns:
      an atomic item of this type
    • compareTo

      default int compareTo(@NonNull IBase64BinaryItem item)
      Compares this value with the argument.
      Parameters:
      item - the item to compare with this value
      Returns:
      a negative integer, zero, or a positive integer if this value is less than, equal to, or greater than the item.