📄 authenticationchoice.java
字号:
package org.javaldap.ldapv3;
//-----------------------------------------------------------------------------
// NOTE: this is a machine generated file - editing not recommended
//
// File: ./src/org/javaldap/ldapv3/AuthenticationChoice.java
//
// Java class for ASN.1 definition AuthenticationChoice as defined in
// module LDAPv3.
// This file was generated by Snacc for Java at Fri Jul 2 18:01:43 1999
// Snacc for Java - Andreas Schade (SAN/ZRL)
//-----------------------------------------------------------------------------
// Import PrintStream class for print methods
import java.io.PrintStream;
// Import ASN.1 basic type representations
import com.ibm.util.*;
// Import ASN.1 decoding/encoding classes
import com.ibm.asn1.*;
/** This class represents the ASN.1 CHOICE type <tt>AuthenticationChoice</tt>.
* Choice classes contain a selector variable <tt>choiceId</tt>
* of type <tt>int</tt> indicating which of the choice elements
* is represented. For each choice element there is a constant
* integer value defined to which <tt>choiceId</tt> can be set.
* <P>The ASN.1 choice elements are represented by public
* member varaibles of the corresponding Java type.
* @author Snacc for Java
* @version Fri Jul 2 18:01:43 1999
*/
public class AuthenticationChoice implements LDAPv3 {
static public final int SIMPLE_CID = 0;
static public final int SASL_CID = 3;
int tag_list[] = { SIMPLE_CID, SASL_CID };
public int choiceId;
public byte[] simple = null;
public SaslCredentials sasl = null;
/** default constructor */
public AuthenticationChoice () {}
/** copy constructor */
public AuthenticationChoice (AuthenticationChoice arg) {
choiceId = arg.choiceId;
switch(choiceId) {
case SIMPLE_CID:
simple = new byte[arg.simple.length];
System.arraycopy(arg.simple,0,simple,0,arg.simple.length);
break;
case SASL_CID:
sasl = new SaslCredentials(arg.sasl);
break;
}
}
/** decoding method.
* @param dec
* decoder object derived from com.ibm.asn1.ASN1Decoder
* @exception com.ibm.asn1.ASN1Exception
* decoding error
*/
public void decode (ASN1Decoder dec) throws ASN1Exception {
int tag = dec.decodeChoice(tag_list);
if (tag == dec.makeTag(dec.CONTEXT_TAG_CLASS,0)) {
dec.nextIsImplicit(dec.makeTag(dec.CONTEXT_TAG_CLASS,0));
simple = dec.decodeOctetString();
choiceId = SIMPLE_CID;
}
if (tag == dec.makeTag(dec.CONTEXT_TAG_CLASS,3)) {
sasl = new SaslCredentials();
dec.nextIsImplicit(dec.makeTag(dec.CONTEXT_TAG_CLASS,3));
sasl.decode(dec);
choiceId = SASL_CID;
}
}
/** encoding method.
* @param enc
* encoder object derived from com.ibm.asn1.ASN1Encoder
* @exception com.ibm.asn1.ASN1Exception
* encoding error
*/
public void encode (ASN1Encoder enc) throws ASN1Exception {
enc.encodeChoice(choiceId, tag_list);
switch(choiceId) {
case SIMPLE_CID:
enc.nextIsImplicit(enc.makeTag(enc.CONTEXT_TAG_CLASS,0));
enc.encodeOctetString(simple);
break;
case SASL_CID:
enc.nextIsImplicit(enc.makeTag(enc.CONTEXT_TAG_CLASS,3));
sasl.encode(enc);
break;
}
}
/** default print method (variable indentation)
* @param os
* PrintStream representing the print destination (file, etc)
*/
public void print (PrintStream os) {
print(os,0);
}
/** print method (variable indentation)
* @param os
* PrintStream representing the print destination (file, etc)
* @param indent
* number of blanks that preceed each output line.
*/
public void print (PrintStream os, int indent) {
os.println("{ -- CHOICE --");
switch(choiceId) {
case SIMPLE_CID:
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("simple = ");
try {
(new HexOutputStream(os)).write(simple);
} catch (java.io.IOException ex) {
os.print("( unprintable OCTET STRING value )");
}
break;
case SASL_CID:
for(int ii = 0; ii < indent+2; ii++) os.print(' ');
os.print("sasl = ");
sasl.print(os, indent+2);
break;
}
for(int ii = 0; ii < indent; ii++) os.print(' ');
os.print("}");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -