XMLDecoderTest.java 文件源码

java
阅读 16 收藏 0 点赞 0 评论 0

项目:cn1 作者:
public void testReadObject_Repeated() throws Exception {
    final Vector<Exception> exceptionList = new Vector<Exception>();

    final ExceptionListener exceptionListener = new ExceptionListener() {
        public void exceptionThrown(Exception e) {
            exceptionList.addElement(e);
        }
    };

    XMLDecoder xmlDecoder = new XMLDecoder(new ByteArrayInputStream(
            xml123bytes));
    xmlDecoder.setExceptionListener(exceptionListener);
    assertEquals(new Integer(1), xmlDecoder.readObject());
    assertEquals(new Integer(2), xmlDecoder.readObject());
    assertEquals(new Integer(3), xmlDecoder.readObject());
    xmlDecoder.close();
    assertEquals(0, exceptionList.size());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号