Class BinaryCodec

  • All Implemented Interfaces:
    UuidCodec<byte[]>

    public class BinaryCodec
    extends Object
    implements UuidCodec<byte[]>
    Codec for UUID binary encoding as defined in the RFC-4122. The UUID is encoded as 16 octets (bytes). Read: https://tools.ietf.org/html/rfc4122 Read also: https://en.wikipedia.org/wiki/Universally_unique_identifier#Encoding
    • Field Detail

      • INSTANCE

        public static final BinaryCodec INSTANCE
        A shared immutable instance.
    • Constructor Detail

      • BinaryCodec

        public BinaryCodec()
    • 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
      • 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 invalid