FileDocCategorySizeDatePackage
BerGenerator.javaAPI DocBouncy Castle Crypto API 1.41 (Java 1.5)2101Wed Oct 01 10:55:28 BST 2008org.bouncycastle.sasn1

BerGenerator

public class BerGenerator extends Asn1Generator
deprecated
use corresponsding classes in org.bouncycastle.asn1.

Fields Summary
private boolean
_tagged
private boolean
_isExplicit
private int
_tagNo
Constructors Summary
protected BerGenerator(OutputStream out)

    
     
         
    
        super(out);
    
public BerGenerator(OutputStream out, int tagNo, boolean isExplicit)

        super(out);
        
        _tagged = true;
        _isExplicit = isExplicit;
        _tagNo = tagNo;
    
Methods Summary
public java.io.OutputStreamgetRawOutputStream()

        return _out;
    
protected voidwriteBerBody(java.io.InputStream contentStream)

        int ch;
        
        while ((ch = contentStream.read()) >= 0)
        {
            _out.write(ch);
        }
    
protected voidwriteBerEnd()

        _out.write(0x00);
        _out.write(0x00);
        
        if (_tagged && _isExplicit)  // write extra end for tag header
        {
            _out.write(0x00);
            _out.write(0x00);
        }
    
protected voidwriteBerHeader(int tag)

        int tagNum = _tagNo | BerTag.TAGGED;
        
        if (_tagged)
        {
            if (_isExplicit)
            {
                writeHdr(tagNum | BerTag.CONSTRUCTED);
                writeHdr(tag);
            }
            else
            {   
                if ((tag & BerTag.CONSTRUCTED) != 0)
                {
                    writeHdr(tagNum | BerTag.CONSTRUCTED);
                }
                else
                {
                    writeHdr(tagNum);
                }
            }
        }
        else
        {
            writeHdr(tag);
        }
    
private voidwriteHdr(int tag)

        _out.write(tag);
        _out.write(0x80);