FileDocCategorySizeDatePackage
XmlBoxTest.javaAPI Docmp4parser 1.0-RC-171219Wed Dec 19 20:10:22 GMT 2012com.coremedia.iso.boxes

XmlBoxTest

public class XmlBoxTest extends Object

Fields Summary
Constructors Summary
Methods Summary
public voidsimpleRoundTrip()

        XmlBox xmlBox = new XmlBox();
        xmlBox.setXml("<a></a>"); // but the box doesnt care if well-formed
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        xmlBox.getBox(Channels.newChannel(baos));

        Properties props = new Properties();
        props.put("xml ", XmlBox.class.getName() + "()");
        PropertyBoxParserImpl parser = new PropertyBoxParserImpl(props);
        IsoFile isoFile = new IsoFile(new ByteBufferByteChannel((ByteBuffer) ByteBuffer.wrap(baos.toByteArray()).rewind()), parser);

        Assert.assertTrue(!isoFile.getBoxes().isEmpty());
        XmlBox xmlBox2 = (XmlBox) isoFile.getBoxes().get(0);
        Assert.assertEquals(xmlBox.getXml(), xmlBox2.getXml());