Package org.ldaptive.asn1
Class UuidType
java.lang.Object
org.ldaptive.asn1.AbstractDERType
org.ldaptive.asn1.UuidType
- All Implemented Interfaces:
DEREncoder
Converts UUIDs to and from their DER encoded format. See RFC 4122.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]
UUID to encode.private static final int
Number of bytes in a uuid. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UUID
Converts bytes in the buffer to a uuid by reading from the current position to the limit.byte[]
encode()
Encode this object into it's DER type.protected static long
Reads the next 8 bytes from the supplied buffer to create a long.static byte[]
Converts the supplied uuid to a byte array.Methods inherited from class org.ldaptive.asn1.AbstractDERType
encode
-
Field Details
-
UUID_LENGTH
private static final int UUID_LENGTHNumber of bytes in a uuid.- See Also:
-
derItem
private final byte[] derItemUUID to encode.
-
-
Constructor Details
-
UuidType
Creates a new uuid type.- Parameters:
item
- to DER encode
-
UuidType
Creates a new uuid type.- Parameters:
tag
- der tag associated with this typeitem
- to DER encode- Throws:
IllegalArgumentException
- if the der tag is constructed
-
-
Method Details
-
encode
public byte[] encode()Description copied from interface:DEREncoder
Encode this object into it's DER type.- Specified by:
encode
in interfaceDEREncoder
- Returns:
- DER encoded object
-
decode
Converts bytes in the buffer to a uuid by reading from the current position to the limit.- Parameters:
encoded
- buffer containing DER-encoded data where the buffer is positioned at the start of uuid bytes and the limit is set beyond the last byte of uuid data.- Returns:
- decoded bytes as a uuid.
-
readLong
Reads the next 8 bytes from the supplied buffer to create a long.- Parameters:
buffer
- to read- Returns:
- UUID component integer
-
toBytes
Converts the supplied uuid to a byte array.- Parameters:
uuid
- to convert- Returns:
- byte array
-