Class Authorizations

    • Constructor Detail

      • Authorizations

        public Authorizations​(Collection<byte[]> authorizations)
        Constructs an authorization object from a collection of string authorizations that have each already been encoded as UTF-8 bytes. Warning: This method does not verify that each encoded string is valid UTF-8.
        Parameters:
        authorizations - collection of authorizations, as strings encoded in UTF-8
        Throws:
        IllegalArgumentException - if authorizations is null
        See Also:
        Authorizations(String...)
      • Authorizations

        public Authorizations​(List<ByteBuffer> authorizations)
        Constructs an authorization object from a list of string authorizations that have each already been encoded as UTF-8 bytes. Warning: This method does not verify that each encoded string is valid UTF-8.
        Parameters:
        authorizations - list of authorizations, as strings encoded in UTF-8 and placed in buffers
        Throws:
        IllegalArgumentException - if authorizations is null
        See Also:
        Authorizations(String...)
      • Authorizations

        public Authorizations​(byte[] authorizations)
        Constructs an authorizations object from a serialized form. This is NOT a constructor for a set of authorizations of size one. Warning: This method does not verify that the encoded serialized form is valid UTF-8.
        Parameters:
        authorizations - a serialized authorizations string produced by getAuthorizationsArray() or serialize(), converted to UTF-8 bytes
        Throws:
        IllegalArgumentException - if authorizations is null
      • Authorizations

        public Authorizations​(String... authorizations)
        Constructs an authorizations object from a set of human-readable authorizations.
        Parameters:
        authorizations - array of authorizations
        Throws:
        IllegalArgumentException - if authorizations is null
    • Method Detail

      • getAuthorizationsArray

        public byte[] getAuthorizationsArray()
        Returns a serialized form of these authorizations.
        Returns:
        serialized form of these authorizations, as a string encoded in UTF-8
        See Also:
        serialize()
      • getAuthorizations

        public List<byte[]> getAuthorizations()
        Gets the authorizations in sorted order. The returned list is not modifiable.
        Returns:
        authorizations, each as a string encoded in UTF-8
        See Also:
        Authorizations(Collection)
      • getAuthorizationsBB

        public List<ByteBuffer> getAuthorizationsBB()
        Gets the authorizations in sorted order. The returned list is not modifiable.
        Returns:
        authorizations, each as a string encoded in UTF-8 and within a buffer
      • contains

        public boolean contains​(byte[] auth)
        Checks whether this object contains the given authorization.
        Parameters:
        auth - authorization, as a string encoded in UTF-8
        Returns:
        true if authorization is in this collection
      • contains

        public boolean contains​(ByteSequence auth)
        Checks whether this object contains the given authorization. Warning: This method does not verify that the encoded string is valid UTF-8.
        Specified by:
        contains in interface AuthorizationContainer
        Parameters:
        auth - authorization, as a string encoded in UTF-8
        Returns:
        true if authorization is in this collection
      • contains

        public boolean contains​(String auth)
        Checks whether this object contains the given authorization.
        Parameters:
        auth - authorization
        Returns:
        true if authorization is in this collection
      • hashCode

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

        public int size()
        Gets the size of this collection of authorizations.
        Returns:
        collection size
      • isEmpty

        public boolean isEmpty()
        Checks if this collection of authorizations is empty.
        Returns:
        true if this collection contains no authorizations
      • serialize

        public String serialize()
        Returns a serialized form of these authorizations. Convert the returned string to UTF-8 bytes to deserialize with Authorizations(byte[]).
        Returns:
        serialized form of authorizations