📄 beroctetstringgenerator.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: BEROctetStringGenerator.java
package org.bouncycastle.asn1;
import java.io.IOException;
import java.io.OutputStream;
// Referenced classes of package org.bouncycastle.asn1:
// BERGenerator, DEROctetString
public class BEROctetStringGenerator extends BERGenerator
{
private class BufferedBEROctetStream extends OutputStream
{
private byte _buf[];
private int _off;
final BEROctetStringGenerator this$0;
public void write(int b)
throws IOException
{
_buf[_off++] = (byte)b;
if (_off == _buf.length)
{
_out.write((new DEROctetString(_buf)).getEncoded());
_off = 0;
}
}
public void write(byte b[], int off, int len)
throws IOException
{
do
{
if (len <= 0)
break;
int numToCopy = Math.min(len, _buf.length - _off);
System.arraycopy(b, off, _buf, _off, numToCopy);
_off += numToCopy;
if (_off < _buf.length)
break;
_out.write((new DEROctetString(_buf)).getEncoded());
_off = 0;
off += numToCopy;
len -= numToCopy;
} while (true);
}
public void close()
throws IOException
{
if (_off != 0)
{
byte bytes[] = new byte[_off];
System.arraycopy(_buf, 0, bytes, 0, _off);
_out.write((new DEROctetString(bytes)).getEncoded());
}
writeBEREnd();
}
BufferedBEROctetStream(byte buf[])
{
this$0 = BEROctetStringGenerator.this;
super();
_buf = buf;
_off = 0;
}
}
public BEROctetStringGenerator(OutputStream out)
throws IOException
{
super(out);
writeBERHeader(36);
}
public BEROctetStringGenerator(OutputStream out, int tagNo, boolean isExplicit)
throws IOException
{
super(out, tagNo, isExplicit);
writeBERHeader(36);
}
public OutputStream getOctetOutputStream()
{
return getOctetOutputStream(new byte[1000]);
}
public OutputStream getOctetOutputStream(byte buf[])
{
return new BufferedBEROctetStream(buf);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -