Package org.ldaptive.asn1
Class UuidType
- java.lang.Object
-
- org.ldaptive.asn1.AbstractDERType
-
- org.ldaptive.asn1.UuidType
-
- All Implemented Interfaces:
DEREncoder
public class UuidType extends AbstractDERType implements DEREncoder
Converts UUIDs to and from their DER encoded format. See RFC 4122.- Author:
- Middleware Services
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.UUID
decode(DERBuffer encoded)
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
readLong(DERBuffer buffer)
Reads the next 8 bytes from the supplied buffer to create a long.static byte[]
toBytes(java.util.UUID uuid)
Converts the supplied uuid to a byte array.-
Methods inherited from class org.ldaptive.asn1.AbstractDERType
encode
-
-
-
-
Constructor Detail
-
UuidType
public UuidType(java.util.UUID item)
Creates a new uuid type.- Parameters:
item
- to DER encode
-
UuidType
public UuidType(DERTag tag, java.util.UUID item)
Creates a new uuid type.- Parameters:
tag
- der tag associated with this typeitem
- to DER encode- Throws:
java.lang.IllegalArgumentException
- if the der tag is constructed
-
-
Method Detail
-
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
public static java.util.UUID decode(DERBuffer encoded)
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
protected static long readLong(DERBuffer buffer)
Reads the next 8 bytes from the supplied buffer to create a long.- Parameters:
buffer
- to read- Returns:
- UUID component integer
-
toBytes
public static byte[] toBytes(java.util.UUID uuid)
Converts the supplied uuid to a byte array.- Parameters:
uuid
- to convert- Returns:
- byte array
-
-