|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.directory.api.ldap.model.ldif.LdifUtils
public final class LdifUtils
Some LDIF helper methods.
| Method Summary | |
|---|---|
static String |
convertAttributesToLdif(Entry entry)
Convert all the Entry's attributes to LDIF. |
static String |
convertAttributesToLdif(Entry entry,
int length)
Convert the Entry's attributes to LDIF. |
static String |
convertToLdif(Attribute attr)
Converts an EntryAttribute to LDIF |
static String |
convertToLdif(Attribute attr,
int length)
Converts an EntryAttribute as LDIF |
static String |
convertToLdif(Attributes attrs)
Convert an Attributes as LDIF |
static String |
convertToLdif(Attributes attrs,
Dn dn)
Convert an Attributes as LDIF. |
static String |
convertToLdif(Attributes attrs,
Dn dn,
int length)
Convert an Attributes as LDIF. |
static String |
convertToLdif(Attributes attrs,
int length)
Convert an Attributes as LDIF |
static String |
convertToLdif(Entry entry)
Convert an Entry to LDIF |
static String |
convertToLdif(Entry entry,
boolean includeVersionInfo)
Convert an Entry to LDIF including a version number at the top |
static String |
convertToLdif(Entry entry,
int length)
Convert an Entry as LDIF |
static String |
convertToLdif(LdifEntry entry)
Convert an LdifEntry to LDIF |
static String |
convertToLdif(LdifEntry entry,
int length)
Convert an LdifEntry to LDIF |
static Attributes |
createJndiAttributes(Object... avas)
Build a new Attributes instance from a LDIF list of lines. |
static Attributes |
getJndiAttributesFromLdif(String ldif)
Convert a LDIF String to a JNDI attributes. |
static boolean |
isLDIFSafe(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 String |
stripLineToNChars(String str,
int nbChars)
Strips the String every n specified characters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isLDIFSafe(String str)
str - the String to be checked
public static String convertToLdif(Attributes attrs)
throws LdapException
attrs - the Attributes to convert
LdapException - If a naming exception is encountered.
public static String convertToLdif(Attributes attrs,
int length)
throws LdapException
attrs - the Attributes to convertlength - The ldif line length
LdapException - If a naming exception is encountered.
public static String convertToLdif(Attributes attrs,
Dn dn,
int length)
throws LdapException
attrs - the Attributes to convertdn - The Dn for this entrylength - The ldif line length
LdapException - If a naming exception is encountered.
public static String convertToLdif(Attributes attrs,
Dn dn)
throws LdapException
attrs - the Attributes to convertdn - The Dn for this entry
LdapException - If a naming exception is encountered.
public static String convertToLdif(Entry entry)
throws LdapException
entry - the Entry to convert
LdapException - If a naming exception is encountered.
public static String convertToLdif(Entry entry,
boolean includeVersionInfo)
throws LdapException
entry - the Entry to convertincludeVersionInfo - flag to tell whether to include version number or not
LdapException - If a naming exception is encountered.
public static String convertAttributesToLdif(Entry entry)
throws LdapException
entry - the Entry to convert
LdapException - If a naming exception is encountered.
public static Attributes getJndiAttributesFromLdif(String ldif)
throws LdapLdifException
ldif - The LDIF string containing an attribute value
LdapLdifException - If the LDIF String cannot be converted to an Attributes
public static String convertToLdif(Entry entry,
int length)
throws LdapException
entry - the Entry to convertlength - the expected line length
LdapException - If a naming exception is encountered.
public static String convertAttributesToLdif(Entry entry,
int length)
throws LdapException
entry - the Entry to convertlength - the expected line length
LdapException - If a naming exception is encountered.
public static String convertToLdif(LdifEntry entry)
throws LdapException
entry - the LdifEntry to convert
LdapException - If a naming exception is encountered.
public static String convertToLdif(LdifEntry entry,
int length)
throws LdapException
entry - the LdifEntry to convertlength - The maximum line's length
LdapException - If a naming exception is encountered.
public static String convertToLdif(Attribute attr)
throws LdapException
attr - the >EntryAttribute to convert
LdapException - If a naming exception is encountered.
public static String convertToLdif(Attribute attr,
int length)
throws LdapException
attr - the EntryAttribute to convertlength - the expected line length
LdapException - If a naming exception is encountered.
public static String stripLineToNChars(String str,
int nbChars)
str - the string to stripnbChars - the number of characters
public static Attributes createJndiAttributes(Object... avas)
throws LdapException
Attribute attr = AttributeUtils.createAttributes(
"objectclass: top",
"cn", "My name",
"jpegPhoto", new byte[]{0x01, 0x02} );
avas - The AttributeType and Values, using a ldif format, or a couple of
Attribute ID/Value
LdapException - If the data are invalid
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||