Package org.ldaptive.ad
Class GlobalIdentifier
- java.lang.Object
-
- org.ldaptive.ad.GlobalIdentifier
-
public final class GlobalIdentifier extends Object
Class to represent an active directory GUID. Provides conversion from binary to string and vice versa.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateGlobalIdentifier()Default constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static byte[]getBytes(ByteBuffer buffer, boolean bigEndian)Reads bytes from the supplied byte buffer.private static voidputBytes(ByteBuffer buffer, byte[] bytes, boolean bigEndian)Writes a long into the supplied byte buffer.static byte[]toBytes(String guid)Converts the supplied GUID to its binary format.static StringtoString(byte[] guid)Converts the supplied GUID to its string format.static StringtoString(byte[] guid, boolean withBrackets)Converts the supplied GUID to its string format.
-
-
-
Method Detail
-
toString
public static String toString(byte[] guid)
Converts the supplied GUID to its string format.- Parameters:
guid- to convert- Returns:
- string format of the GUID
-
toString
public static String toString(byte[] guid, boolean withBrackets)
Converts the supplied GUID to its string format.- Parameters:
guid- to convertwithBrackets- whether to enclose guid in brackets- Returns:
- string format of the GUID
-
toBytes
public static byte[] toBytes(String guid)
Converts the supplied GUID to its binary format. Detects whether the supplied guid is enclosed in brackets.- Parameters:
guid- to convert- Returns:
- binary format of the GUID
-
getBytes
private static byte[] getBytes(ByteBuffer buffer, boolean bigEndian)
Reads bytes from the supplied byte buffer. The byte buffer limit must be set appropriately by the caller.- Parameters:
buffer- to read bytes frombigEndian- whether to return the bytes as big endian- Returns:
- long value
-
putBytes
private static void putBytes(ByteBuffer buffer, byte[] bytes, boolean bigEndian)
Writes a long into the supplied byte buffer. The byte buffer limit must be set appropriately by the caller.- Parameters:
buffer- to write long tobytes- to writebigEndian- whether to write the bytes as big endian
-
-