Code example for XMLDecoder

Methods: closereadObject

0
            public void exceptionThrown(Exception exception) {
                throw new Error("unexpected exception", exception);
            } 
        }; 
 
        XMLDecoder decoder = new XMLDecoder(stream, null, el, cl);
        Object object = decoder.readObject();
        decoder.close();
 
        if (!type.equals(object.getClass())) {
            throw new Error("unexpected " + object.getClass());
        } 
    } 
}