public class LdifUtils extends Object
Constructor and Description |
---|
LdifUtils() |
Modifier and Type | Method and Description |
---|---|
static Attributes |
convertAttributesFromLdif(String ldif)
Convert a LDIF String to an attributes.
|
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 |
convertEntryToLdif(Entry entry)
Convert an Entry to LDIF
|
static String |
convertEntryToLdif(Entry entry,
int length)
Convert an Entry 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(EntryAttribute attr)
Converts an EntryAttribute to LDIF
|
static String |
convertToLdif(EntryAttribute attr,
int length)
Converts an EntryAttribute 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 |
createAttributes(Object... avas)
Build a new Attributes instance from a LDIF list of lines.
|
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
|
public static boolean isLDIFSafe(String str)
str
- the String to be checkedpublic static String convertToLdif(Attributes attrs) throws LdapException
attrs
- the Attributes to convertLdapException
- If a naming exception is encountered.public static String convertToLdif(Attributes attrs, int length) throws LdapException
attrs
- the Attributes to convertLdapException
- If a naming exception is encountered.public static String convertToLdif(Attributes attrs, DN dn, int length) throws LdapException
attrs
- the Attributes to convertLdapException
- If a naming exception is encountered.public static String convertToLdif(Attributes attrs, DN dn) throws LdapException
attrs
- the Attributes to convertLdapException
- If a naming exception is encountered.public static String convertEntryToLdif(Entry entry) throws LdapException
entry
- the Entry to convertLdapException
- If a naming exception is encountered.public static String convertAttributesToLdif(Entry entry) throws LdapException
entry
- the Entry to convertLdapException
- If a naming exception is encountered.public static Attributes convertAttributesFromLdif(String ldif) throws LdapLdifException
ldif
- The LDIF string containing an attribute valueLdapException
- If the LDIF String cannot be converted to an AttributesLdapLdifException
public static String convertEntryToLdif(Entry entry, int length) throws LdapException
entry
- the Entry to convertlength
- the expected line lengthLdapException
- If a naming exception is encountered.public static String convertAttributesToLdif(Entry entry, int length) throws LdapException
entry
- the Entry to convertlength
- the expected line lengthLdapException
- If a naming exception is encountered.public static String convertToLdif(LdifEntry entry) throws LdapException
entry
- the LdifEntry to convertLdapException
- 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 lengthLdapException
- If a naming exception is encountered.public static String convertToLdif(EntryAttribute attr) throws LdapException
attr
- the >EntryAttribute to convertLdapException
- If a naming exception is encountered.public static String convertToLdif(EntryAttribute attr, int length) throws LdapException
attr
- the EntryAttribute to convertlength
- the expected line lengthLdapException
- If a naming exception is encountered.public static String stripLineToNChars(String str, int nbChars)
str
- the string to stripnbChars
- the number of characterspublic static Attributes createAttributes(Object... avas) throws LdapException, LdapLdifException
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/ValueLdapException
- If the data are invalidLdapLdifException
Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.