|
LDAP Classes Implements Java LDAP |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.novell.ldap.util.Base64
The Base64 utility class performs base64 encoding and decoding. The Base64 Content-Transfer-Encoding is designed to represent arbitrary sequences of octets in a form that need not be humanly readable. The encoding and decoding algorithms are simple, but the encoded data are consistently only about 33 percent larger than the unencoded data. The base64 encoding algorithm is defined by RFC 2045.
Method Summary | |
static byte[] |
decode(char[] encodedChars)
Decodes the input base64 encoded array of characters. |
static byte[] |
decode(java.lang.String encodedString)
Decodes the input base64 encoded String. |
static byte[] |
decode(java.lang.StringBuffer encodedSBuf,
int start,
int end)
Decodes a base64 encoded StringBuffer. |
static java.lang.String |
encode(byte[] inputBytes)
Encodes the specified bytes into a base64 array of bytes. |
static java.lang.String |
encode(java.lang.String inputString)
Encodes the specified String into a base64 encoded String object. |
static boolean |
isLDIFSafe(byte[] bytes)
Checks if the input byte array contains only safe values, that is, the data does not need to be encoded for use with LDIF. |
static boolean |
isLDIFSafe(java.lang.String str)
Checks if the input String contains only safe values, that is, the data does not need to be encoded for use with LDIF. |
static boolean |
isValidUTF8(byte[] array,
boolean isUCS2Only)
Determines if an array of bytes contains only valid UTF-8 characters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static final java.lang.String encode(java.lang.String inputString)
inputString
- The String object to be encoded.
public static final java.lang.String encode(byte[] inputBytes)
inputBytes
- the byte array to be encoded.
public static final byte[] decode(java.lang.String encodedString)
encodedString
- The base64 encoded String object.
public static final byte[] decode(char[] encodedChars)
encodedChars
- The character array containing the base64 encoded data.
public static final byte[] decode(java.lang.StringBuffer encodedSBuf, int start, int end)
encodedSBuf
- The StringBuffer object that contains base64
encoded data.start
- The start index of the base64 encoded data.end
- The end index + 1 of the base64 encoded data.
public static final boolean isLDIFSafe(byte[] bytes)
The data cannot start with the following byte values:
00 (NUL) 10 (LF) 13 (CR) 32 (SPACE) 58 (:) 60 (<) Any character with value greater than 127 (Negative for a byte value)
The data cannot contain any of the following byte values:
00 (NUL) 10 (LF) 13 (CR) Any character with value greater than 127 (Negative for a byte value)
The data cannot end with a space.
bytes
- the bytes to be checked.
public static final boolean isLDIFSafe(java.lang.String str)
The data cannot start with the following char values:
00 (NUL) 10 (LF) 13 (CR) 32 (SPACE) 58 (:) 60 (<) Any character with value greater than 127
The data cannot contain any of the following char values:
00 (NUL) 10 (LF) 13 (CR) Any character with value greater than 127
The data cannot end with a space.
str
- the String to be checked.
public static boolean isValidUTF8(byte[] array, boolean isUCS2Only)
UTF-8 is the standard encoding for LDAP strings. If a value contains data that is not valid UTF-8 then data is lost converting the value to a Java String.
In addition, Java Strings currently use UCS2 (Unicode Code Standard
2-byte characters). UTF-8 can be encoded as USC2 and UCS4 (4-byte
characters). Some valid UTF-8 characters cannot be represented as UCS2
characters. To determine if all UTF-8 sequences can be encoded into
UCS2 characters (a Java String), specify the isUCS2Only
parameter as true
.
array
- An array of bytes that are to be tested for valid UTF-8
encoding.
isUCS2Only
- true if the UTF-8 values must be restricted to fit
within UCS2 encoding (2 bytes)
isUCS2Only
is
true
, the method returns false if a UTF-8
sequence generates any character that cannot be
represented as a UCS2 character (Java String)
|
LDAP Classes Implements Java LDAP |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |