Class ExtendedUUID

  • All Implemented Interfaces:
    java.lang.Comparable<Address>, Address, Constructable<UUID>, SizeStreamable, Streamable
    Direct Known Subclasses:
    SiteUUID

    public class ExtendedUUID
    extends FlagsUUID
    Subclass of UUID accommodating additional data such as a flag and a small hashmap. There may be many instances in memory, and as they are serialized a lot and sent across the wire, I tried to make this as compact as possible. As a consequence, the hashmap can have a max size of 255 and a value can have a max length of 255 bytes.
    Since:
    3.5
    Author:
    Bela Ban
    • Field Detail

      • keys

        protected byte[][] keys
      • values

        protected byte[][] values
      • print_function

        protected static java.util.function.Function<ExtendedUUID,​java.lang.String> print_function
    • Constructor Detail

      • ExtendedUUID

        public ExtendedUUID()
      • ExtendedUUID

        protected ExtendedUUID​(byte[] data)
      • ExtendedUUID

        public ExtendedUUID​(long mostSigBits,
                            long leastSigBits)
      • ExtendedUUID

        public ExtendedUUID​(T o)
    • Method Detail

      • create

        public java.util.function.Supplier<? extends UUID> create()
        Description copied from interface: Constructable
        Creates an instance of the class implementing this interface
        Specified by:
        create in interface Constructable<UUID>
        Overrides:
        create in class FlagsUUID
      • setPrintFunction

        public static void setPrintFunction​(java.util.function.Function<ExtendedUUID,​java.lang.String> f)
      • randomUUID

        public static ExtendedUUID randomUUID​(java.lang.String name)
      • get

        public byte[] get​(byte[] key)
      • get

        public byte[] get​(java.lang.String key)
      • put

        public ExtendedUUID put​(byte[] key,
                                byte[] val)
      • put

        protected ExtendedUUID put​(int start_index,
                                   byte[] key,
                                   byte[] val)
      • put

        public ExtendedUUID put​(java.lang.String key,
                                byte[] val)
      • remove

        public byte[] remove​(byte[] key)
      • remove

        public byte[] remove​(java.lang.String key)
      • keyExists

        public boolean keyExists​(byte[] key)
      • keyExists

        public boolean keyExists​(java.lang.String key)
      • writeTo

        public void writeTo​(java.io.DataOutput out)
                     throws java.io.IOException
        Description copied from interface: Streamable
        Write the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed
        Specified by:
        writeTo in interface Streamable
        Overrides:
        writeTo in class FlagsUUID
        Throws:
        java.io.IOException
      • readFrom

        public void readFrom​(java.io.DataInput in)
                      throws java.io.IOException
        Description copied from interface: Streamable
        Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
        Specified by:
        readFrom in interface Streamable
        Overrides:
        readFrom in class FlagsUUID
        Throws:
        java.io.IOException
      • length

        public int length()
        The number of non-null keys
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class FlagsUUID
      • print

        public java.lang.String print()
      • write

        protected void write​(java.io.DataOutput out)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        protected void read​(java.io.DataInput in)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • sizeofHashMap

        protected int sizeofHashMap()
      • resize

        protected void resize​(int new_length)