Code example for ByteArrayOutputStream

Methods: toByteArray

0
public abstract class BCPGObject  
{ 
    public byte[] getEncoded()  
        throws IOException 
    { 
        ByteArrayOutputStream    bOut = new ByteArrayOutputStream();
        BCPGOutputStream         pOut = new BCPGOutputStream(bOut);
         
        pOut.writeObject(this);
         
        return bOut.toByteArray();
    } 
     
    public abstract void encode(BCPGOutputStream out)
        throws IOException; 
}