Code example for ObjectInput

Methods: read, readBoolean, readInt, readObject

0
     * @throws ClassNotFoundException  
     */ 
    public void readExternal(ObjectInput in)
        throws IOException, ClassNotFoundException { 
 
        this.id = (String)in.readObject();
 
        this.state = in.readInt();
 
        String stringElement = (String)in.readObject();
        this.token = convertStringToOMElement(stringElement);
 
        stringElement = (String)in.readObject();
        this.previousToken = convertStringToOMElement(stringElement);
 
        stringElement = (String)in.readObject();
        this.attachedReference = convertStringToOMElement(stringElement);
 
        stringElement = (String)in.readObject();
        this.unattachedReference = convertStringToOMElement(stringElement);
 
        this.properties = (Properties)in.readObject();
 
        this.changed = in.readBoolean();
 
        // Read the length of the secret 
        int secretLength = in.readInt();
 
        if (0 != secretLength) {
            byte[] buffer = new byte[secretLength];
            if (secretLength != in.read(buffer)) {
                throw new IllegalStateException("Bytes read from the secret key is not equal to serialized length");
            } 
            this.secret = buffer;
        }else{ 
            this.secret = null;
        } 
 
        this.created = (Date)in.readObject();
 
        this.expires = (Date)in.readObject();
 
        this.issuerAddress = (String)in.readObject();
 
        this.encrKeySha1Value = (String)in.readObject();
    } 
 
    private String convertOMElementToString(OMElement element)
        throws IOException { 
        String serializedToken = "";