bertaggedobject.java
来自「《移动Agent技术》一书的所有章节源代码。」· Java 代码 · 共 98 行
JAVA
98 行
package org.bouncycastle.asn1;import java.io.*;import java.util.*;/** * BER TaggedObject - in ASN.1 nottation this is any object proceeded by * a [n] where n is some number - these are assume to follow the construction * rules (as with sequences). */public class BERTaggedObject extends DERTaggedObject{ /** * This creates an empty tagged object of tagNo (ie. zero length). * * @param tagNo the tag number for this object. */ public BERTaggedObject( int tagNo) { super(tagNo); } /** * @param tagNo the tag number for this object. * @param obj the tagged object. */ public BERTaggedObject( int tagNo, DERObject obj) { super(tagNo, obj); } /** * @param explicit true if an explicitly tagged object. * @param tagNo the tag number for this object. * @param obj the tagged object. */ public BERTaggedObject( boolean explicit, int tagNo, DERObject obj) { super(explicit, tagNo, obj); } void encode( DEROutputStream out) throws IOException { if (out instanceof BEROutputStream) { out.write(CONSTRUCTED | TAGGED | tagNo); out.write(0x80); if (!empty) { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); BEROutputStream dOut = new BEROutputStream(bOut); if (!explicit) { if (obj instanceof BERConstructedOctetString) { Vector octs = ((BERConstructedOctetString)obj).getDEROctets(); for (int i = 0; i != octs.size(); i++) { dOut.writeObject(octs.elementAt(i)); } } else { dOut.writeObject(obj); // hmmm... } } else { dOut.writeObject(obj); } dOut.close(); out.write(bOut.toByteArray()); } out.write(0x00); out.write(0x00); } else { super.encode(out); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?