org.apache.directory.shared.ldap.codec.util
Class LdapString

java.lang.Object
  extended byorg.apache.directory.shared.ldap.codec.util.LdapString
Direct Known Subclasses:
LdapURL

public class LdapString
extends java.lang.Object

Decodes a LdapString, and checks that the character set used comply the ISO 10646 encoded following the UTF-8 algorithm (RFC 2044, RFC 2279)

Author:
Apache Directory Project

Field Summary
protected  byte[] bytes
          The internal bytes representation of the LdapString
static byte[] EMPTY_BYTES
          A null LdapString
static LdapString EMPTY_STRING
          A null LdapString
protected  java.lang.String string
          The inner String containing the LdapString
 
Constructor Summary
LdapString()
          Construct an empty LdapString
LdapString(byte[] bytes)
          Transform a byte array to a String.
 
Method Summary
 byte[] getBytes()
          Get the content of the LdapString, as a byte array;
 int getNbBytes()
          Get the size of the UTF-8 encoded string
 java.lang.String getString()
          Get the LdapString as a String
 java.lang.String toString()
          Return the string representation of a LdapString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_STRING

public static final transient LdapString EMPTY_STRING
A null LdapString


EMPTY_BYTES

public static final transient byte[] EMPTY_BYTES
A null LdapString


string

protected java.lang.String string
The inner String containing the LdapString


bytes

protected byte[] bytes
The internal bytes representation of the LdapString

Constructor Detail

LdapString

public LdapString()
Construct an empty LdapString


LdapString

public LdapString(byte[] bytes)
           throws LdapStringEncodingException
Transform a byte array to a String. The byte array contains an UTF-8 representation of a String.

Parameters:
bytes - The byte buffer that contains the LDAPSTRING
Throws:
LdapStringEncodingException - If the byte array is not a UTF-8 encoded ISO-10646 (Unicode) compatible String.
Method Detail

getString

public java.lang.String getString()
Get the LdapString as a String

Returns:
The string.

getBytes

public byte[] getBytes()
Get the content of the LdapString, as a byte array;

Returns:
A byte array of the LdapString string

getNbBytes

public int getNbBytes()
Get the size of the UTF-8 encoded string

Returns:
A number of bytes

toString

public java.lang.String toString()
Return the string representation of a LdapString



Copyright © 2003-2006 . All Rights Reserved.