⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 escapingdns.java

📁 it contains the practical programs in our college
💻 JAVA
字号:
import javax.naming.ldap.*;
import javax.naming.*;

/*
 * Shows how to format DNs with special characters by escaping
 * the values
 */

public class EscapingDNs {
    
    public static void main(String args[]) {
        try {
            // DN with ',' (comma) in its attribute value
            String unformatted = "Juicy, Fruit";
            String formatted = Rdn.escapeValue(unformatted);
            LdapName dn = new LdapName("cn=" + formatted);
            System.out.println("dn:" + dn);

             // DN with a '+' (plus) in its attribute value
            unformatted = "true+false";
            formatted = Rdn.escapeValue(unformatted); 
            dn = new LdapName("cn=" + formatted);
            System.out.println("dn:" + dn);

            // DN with a binary value as its attribute value
            byte[] bytes = new byte[] {1, 2, 3, 4};
            formatted = Rdn.escapeValue(bytes);
            System.out.println("Orig val: " + bytes +
                    " Escaped val: " + formatted);
        } catch (InvalidNameException e) {
            e.printStackTrace();
        }
    } 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -