Package java.beans

Examples of java.beans.XMLEncoder


    public void testXMLEncoder_Null() throws NullPointerException {
        new XMLEncoder(null);
    }

    public void testGetOwner() {
        XMLEncoder enc = new XMLEncoder(System.out);
        assertNull(enc.getOwner());
    }
View Full Code Here


        XMLEncoder enc = new XMLEncoder(System.out);
        assertNull(enc.getOwner());
    }

    public void testSetOwner() {
        XMLEncoder enc = new XMLEncoder(System.out);
        Object owner = Boolean.FALSE;

        enc.setOwner(owner);
        assertSame(owner, enc.getOwner());

        enc.setOwner(null);
        assertNull(enc.getOwner());
    }
View Full Code Here

        assertNull(enc.getOwner());
    }

    private void assertCodedXML(Object obj, String xmlFile) throws Exception {
        ByteArrayOutputStream temp = new ByteArrayOutputStream();
        XMLEncoder enc = new XMLEncoder(temp);

        assertCodedXML(obj, xmlFile, temp, enc);
    }
View Full Code Here

        String saxParserClassName = System.getProperty("org.xml.sax.driver");
        String version = System.getProperty("java.version");

        if (enc == null || temp == null) {
            temp = new ByteArrayOutputStream();
            enc = new XMLEncoder(temp);
        }
        enc.writeObject(obj);
        enc.close();
        byte bytes[] = temp.toByteArray();
        xml = new InputStreamReader(new ByteArrayInputStream(bytes), "UTF-8");
View Full Code Here

    /**
     * The test checks that java.lang.Boolean exemplar store is correct
     */
    public void testEncodeBoolean() {
        XMLEncoder e = new XMLEncoder(System.out);
        e.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                fail("Exception " + e.getClass() + " is thrown: "
                        + e.getMessage());
            }
        });

        try {
            e.writeObject(new Boolean(true));
        } finally {
            e.close();
        }
    }
View Full Code Here

    /**
     * The test checks that java.lang.Byte exemplar store is correct
     */
    public void testEncodeByte() {
        XMLEncoder e = new XMLEncoder(System.out);
        e.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                fail("Exception " + e.getClass() + " is thrown: "
                        + e.getMessage());
            }
        });

        try {
            e.writeObject(new Byte((byte) 123));
        } finally {
            e.close();
        }
    }
View Full Code Here

    /**
     * The test checks that java.lang.Character exemplar store is correct
     */
    public void testEncodeCharacter() {
        XMLEncoder e = new XMLEncoder(System.out);
        e.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                fail("Exception " + e.getClass() + " is thrown: "
                        + e.getMessage());
            }
        });

        try {
            e.writeObject(new Character('a'));
        } finally {
            e.close();
        }
    }
View Full Code Here

    /**
     * The test checks that java.lang.Class exemplar store is correct
     */
    public void testEncodeClass() {
        XMLEncoder e = new XMLEncoder(System.out);
        e.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                fail("Exception " + e.getClass() + " is thrown: "
                        + e.getMessage());
            }
        });

        try {
            e.writeObject(Object.class);
        } finally {
            e.close();
        }
    }
View Full Code Here

    /**
     * The test checks that java.lang.Double exemplar store is correct
     */
    public void testEncodeDouble() {
        XMLEncoder e = new XMLEncoder(System.out);
        e.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                fail("Exception " + e.getClass() + " is thrown: "
                        + e.getMessage());
            }
        });

        try {
            e.writeObject(new Double(0.01));
        } finally {
            e.close();
        }
    }
View Full Code Here

    /**
     * The test checks that java.lang.Float exemplar store is correct
     */
    public void testEncodeFloat() {
        XMLEncoder e = new XMLEncoder(System.out);
        e.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                fail("Exception " + e.getClass() + " is thrown: "
                        + e.getMessage());
            }
        });

        try {
            e.writeObject(new Float((float) 0.01));
        } finally {
            e.close();
        }
    }
View Full Code Here

TOP

Related Classes of java.beans.XMLEncoder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.