1 package com.coremedia.iso.boxes.apple; 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 * Apple Name box. Allowed as subbox of "----" box. 11 * 12 * @see AppleGenericBox 13 */ 14 public final class AppleNameBox extends AbstractFullBox { 15 public static final String TYPE = "name"; 16 private String name; 17 AppleNameBox()18 public AppleNameBox() { 19 super(TYPE); 20 } 21 getContentSize()22 protected long getContentSize() { 23 return 4 + Utf8.convert(name).length; 24 } 25 getName()26 public String getName() { 27 return name; 28 } 29 setName(String name)30 public void setName(String name) { 31 this.name = name; 32 } 33 34 @Override _parseDetails(ByteBuffer content)35 public void _parseDetails(ByteBuffer content) { 36 parseVersionAndFlags(content); 37 name = IsoTypeReader.readString(content, content.remaining()); 38 } 39 40 @Override getContent(ByteBuffer byteBuffer)41 protected void getContent(ByteBuffer byteBuffer) { 42 writeVersionAndFlags(byteBuffer); 43 byteBuffer.put(Utf8.convert(name)); 44 } 45 } 46