1 package com.coremedia.iso.boxes; 2 3 import com.coremedia.iso.IsoTypeReader; 4 import com.coremedia.iso.Utf8; 5 import com.googlecode.mp4parser.AbstractFullBox; 6 7 import java.nio.ByteBuffer; 8 9 /** 10 * 11 */ 12 public class XmlBox extends AbstractFullBox { 13 String xml = ""; 14 public static final String TYPE = "xml "; 15 XmlBox()16 public XmlBox() { 17 super(TYPE); 18 } 19 getXml()20 public String getXml() { 21 return xml; 22 } 23 setXml(String xml)24 public void setXml(String xml) { 25 this.xml = xml; 26 } 27 28 @Override getContentSize()29 protected long getContentSize() { 30 return 4 + Utf8.utf8StringLengthInBytes(xml); 31 } 32 33 @Override _parseDetails(ByteBuffer content)34 public void _parseDetails(ByteBuffer content) { 35 parseVersionAndFlags(content); 36 xml = IsoTypeReader.readString(content, content.remaining()); 37 } 38 39 @Override getContent(ByteBuffer byteBuffer)40 protected void getContent(ByteBuffer byteBuffer) { 41 writeVersionAndFlags(byteBuffer); 42 byteBuffer.put(Utf8.convert(xml)); 43 } 44 45 @Override toString()46 public String toString() { 47 return "XmlBox{" + 48 "xml='" + xml + '\'' + 49 '}'; 50 } 51 } 52