public class Authorizations extends Object implements Iterable<byte[]>, Serializable, AuthorizationContainer
Modifier and Type | Field and Description |
---|---|
static Authorizations |
EMPTY
An empty set of authorizations.
|
static String |
HEADER
A special header string used when serializing instances of this class.
|
Constructor and Description |
---|
Authorizations()
Constructs an empty set of authorizations.
|
Authorizations(byte[] authorizations)
Constructs an authorizations object from a serialized form.
|
Authorizations(Collection<byte[]> authorizations)
Constructs an authorization object from a collection of string authorizations that have each already been encoded as UTF-8 bytes.
|
Authorizations(List<ByteBuffer> authorizations)
Constructs an authorization object from a list of string authorizations that have each already been encoded as UTF-8 bytes.
|
Authorizations(String... authorizations)
Constructs an authorizations object from a set of human-readable authorizations.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(byte[] auth)
Checks whether this object contains the given authorization.
|
boolean |
contains(ByteSequence auth)
Checks whether this object contains the given authorization.
|
boolean |
contains(String auth)
Checks whether this object contains the given authorization.
|
boolean |
equals(Object o) |
List<byte[]> |
getAuthorizations()
Gets the authorizations in sorted order.
|
byte[] |
getAuthorizationsArray()
Returns a serialized form of these authorizations.
|
List<ByteBuffer> |
getAuthorizationsBB()
Gets the authorizations in sorted order.
|
int |
hashCode() |
boolean |
isEmpty()
Checks if this collection of authorizations is empty.
|
Iterator<byte[]> |
iterator() |
String |
serialize()
Returns a serialized form of these authorizations.
|
int |
size()
Gets the size of this collection of authorizations.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final Authorizations EMPTY
public static final String HEADER
serialize()
,
Constant Field Valuespublic Authorizations(Collection<byte[]> authorizations)
authorizations
- collection of authorizations, as strings encoded in UTF-8IllegalArgumentException
- if authorizations is nullAuthorizations(String...)
public Authorizations(List<ByteBuffer> authorizations)
authorizations
- list of authorizations, as strings encoded in UTF-8 and placed in buffersIllegalArgumentException
- if authorizations is nullAuthorizations(String...)
public Authorizations(byte[] authorizations)
authorizations
- a serialized authorizations string produced by getAuthorizationsArray()
or serialize()
, converted to UTF-8 bytesIllegalArgumentException
- if authorizations is nullpublic Authorizations()
Authorizations(String...)
public Authorizations(String... authorizations)
authorizations
- array of authorizationsIllegalArgumentException
- if authorizations is nullpublic byte[] getAuthorizationsArray()
serialize()
public List<byte[]> getAuthorizations()
Authorizations(Collection)
public List<ByteBuffer> getAuthorizationsBB()
public boolean contains(byte[] auth)
auth
- authorization, as a string encoded in UTF-8public boolean contains(ByteSequence auth)
contains
in interface AuthorizationContainer
auth
- authorization, as a string encoded in UTF-8public boolean contains(String auth)
auth
- authorizationpublic int size()
public boolean isEmpty()
public String serialize()
Authorizations(byte[])
.Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.