public final class LdapUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areEqual(Object o1,
Object o2)
Determines equality of the supplied objects by delegating to their hashCode methods.
|
static byte[] |
base64Decode(String value)
This will decode the supplied value as a base64 encoded string to a byte[].
|
static String |
base64Encode(byte[] value)
This will convert the supplied value to a base64 encoded string.
|
static String |
base64Encode(String value)
This will convert the supplied value to a base64 encoded string.
|
static int |
computeHashCode(int seed,
Object... objects)
Computes a hash code for the supplied objects using the supplied seed.
|
static <T> T[] |
concatArrays(T[] first,
T[]... rest)
Concatenates multiple arrays together.
|
static InputStream |
getResource(String path)
Parses the supplied path and returns an input stream based on the prefix in the path.
|
static byte[] |
hexDecode(char[] value)
This will decode the supplied value as a hex encoded string to a byte[].
|
static char[] |
hexEncode(byte[] value)
This will convert the supplied value to a hex encoded string.
|
static char[] |
hexEncode(char... value)
This will convert the supplied value to a hex encoded string.
|
static boolean |
isIPAddress(String s)
Returns whether the supplied string represents an IP address.
|
static String |
percentDecode(String value)
Implementation of percent decoding as described in RFC 3986 section 2.1.
|
static String |
percentEncode(String value)
Implementation of percent encoding as described in RFC 3986 section 2.1.
|
static byte[] |
readInputStream(InputStream is)
Reads the data in the supplied stream and returns it as a byte array.
|
static byte[] |
readURL(URL url)
Reads the data at the supplied URL and returns it as a byte array.
|
static String |
utf8Encode(byte[] value)
This will convert the supplied value to a UTF-8 encoded string.
|
static byte[] |
utf8Encode(String value)
This will convert the supplied value to a UTF-8 encoded byte array.
|
public static String base64Encode(byte[] value)
value - to base64 encodepublic static String base64Encode(String value)
value - to base64 encodepublic static String utf8Encode(byte[] value)
value - to UTF-8 encodepublic static byte[] utf8Encode(String value)
value - to UTF-8 encodepublic static char[] hexEncode(byte[] value)
value - to hex encodepublic static char[] hexEncode(char... value)
value - to hex encodepublic static String percentEncode(String value)
value - to encodepublic static byte[] base64Decode(String value)
value - to base64 decodepublic static byte[] hexDecode(char[] value)
value - to hex decodepublic static String percentDecode(String value)
value - to decodepublic static byte[] readURL(URL url) throws IOException
url - to readIOException - if an error occurs reading datapublic static byte[] readInputStream(InputStream is) throws IOException
is - stream to readIOException - if an error occurs reading datapublic static <T> T[] concatArrays(T[] first,
T[]... rest)
T - type of arrayfirst - array to concatenate. Cannot be null.rest - of the arrays to concatenate. May be null.public static boolean areEqual(Object o1, Object o2)
o1 - to test equality ofo2 - to test equality ofpublic static int computeHashCode(int seed,
Object... objects)
seed - odd/prime numberobjects - to calculate hashCode forpublic static boolean isIPAddress(String s)
s - to matchpublic static InputStream getResource(String path) throws IOException
path - that designates a resourceIOException - if the resource cannot be readIllegalArgumentException - if path is not prefixed with either 'classpath:' or 'file:'Copyright © 2023. All rights reserved.