Example usage for javax.naming.ldap Rdn unescapeValue

List of usage examples for javax.naming.ldap Rdn unescapeValue

Introduction

In this page you can find the example usage for javax.naming.ldap Rdn unescapeValue.

Prototype

public static Object unescapeValue(String val) 

Source Link

Document

Given an attribute value string formatted according to the rules specified in <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>, returns the unformatted value.

Usage

From source file:UnescapingValues.java

public static void main(String args[]) {
    // DN with ',' (comma)
    String unformatted = "Juicy, Fruit";
    String formatted = Rdn.escapeValue(unformatted);
    System.out.println("Formatted:" + formatted);
    Object original = Rdn.unescapeValue(formatted);
    System.out.println("Original:" + original);

    // DN with a '+' (plus)
    unformatted = "true+false";
    formatted = Rdn.escapeValue(unformatted);
    System.out.println("Formatted:" + formatted);
    original = Rdn.unescapeValue(formatted);
    System.out.println("Original:" + original);

    // DN with a binary value as one one of its attribute value
    byte[] bytes = new byte[] { 1, 2, 3, 4 };
    formatted = Rdn.escapeValue(bytes);
    System.out.println("Formatted:" + formatted);
    original = Rdn.unescapeValue(formatted);
    System.out.println("Original:" + original);
}