Class StandardBinaryCodec

  • All Implemented Interfaces:
    UuidCodec<byte[]>

    public class StandardBinaryCodec
    extends Object
    implements UuidCodec<byte[]>
    Codec for UUID binary encoding as defined in RFC 9562.

    The UUID is encoded as 16 octets (bytes).

    See Also:
    RFC 9562
    • Constructor Detail

      • StandardBinaryCodec

        public StandardBinaryCodec()
    • Method Detail

      • encode

        public byte[] encode​(UUID uuid)
        Get an array of bytes from a UUID.
        Specified by:
        encode in interface UuidCodec<byte[]>
        Parameters:
        uuid - a UUID
        Returns:
        an array of bytes
        Throws:
        InvalidUuidException - if the argument is invalid
      • decode

        public UUID decode​(byte[] bytes)
        Get a UUID from an array of bytes.
        Specified by:
        decode in interface UuidCodec<byte[]>
        Parameters:
        bytes - an array of bytes
        Returns:
        a UUID
        Throws:
        InvalidUuidException - if the argument is invalid