berconstructedsequence.java
来自「《移动Agent技术》一书的所有章节源代码。」· Java 代码 · 共 50 行
JAVA
50 行
package org.bouncycastle.asn1;import java.io.*;import java.util.*;public class BERConstructedSequence extends DERConstructedSequence{ /* * A note on the implementation: * <p> * As DER requires the constructed, definite-length model to * be used for structured types, this varies slightly from the * ASN.1 descriptions given. Rather than just outputing SEQUENCE, * we also have to specify CONSTRUCTED, and the objects length. */ void encode( DEROutputStream out) throws IOException { if (out instanceof BEROutputStream) { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); BEROutputStream dOut = new BEROutputStream(bOut); Enumeration e = getObjects(); while (e.hasMoreElements()) { Object obj = e.nextElement(); dOut.writeObject(obj); } dOut.close(); byte[] bytes = bOut.toByteArray(); out.write(SEQUENCE | CONSTRUCTED); out.write(0x80); out.write(bytes); out.write(0x00); out.write(0x00); } else { super.encode(out); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?