2016-06-29 55 views

回答

0

ASN1Object.getEncoded

public byte[] getEncoded() 
    throws IOException 
{ 
    ByteArrayOutputStream bOut = new ByteArrayOutputStream(); 
    ASN1OutputStream  aOut = new ASN1OutputStream(bOut); 

    aOut.writeObject(this); // This is where the throws happens. 

    return bOut.toByteArray(); 
} 

ASN1OutputStream.writeObject

public void writeObject(
    ASN1Encodable obj) 
    throws IOException 
{ 
    if (obj != null) 
    { 
     obj.toASN1Primitive().encode(this); 
    } 
    else 
    { 
     throw new IOException("null object detected"); 
    } 
} 

除非子類重寫了getEncoded,在這方面的IOException意味着一個或多個涉及到的對象都是零。

相關問題