|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.coremedia.iso.boxes.AbstractBox
com.coremedia.iso.boxes.AbstractContainerBox
public abstract class AbstractContainerBox
Abstract base class suitable for most boxes acting purely as container for other boxes.
Field Summary | |
---|---|
protected List<Box> |
boxes
|
protected BoxParser |
boxParser
|
Fields inherited from class com.coremedia.iso.boxes.AbstractBox |
---|
deadBytes, type |
Constructor Summary | |
---|---|
AbstractContainerBox(String type)
|
Method Summary | ||
---|---|---|
void |
_parseDetails(ByteBuffer content)
Implement the actual parsing of the box's fields here. |
|
void |
addBox(Box b)
Add b to the container and sets the parent correctly. |
|
List<Box> |
getBoxes()
Gets all child boxes. |
|
|
getBoxes(Class<T> clazz)
Gets all child boxes of the given type. |
|
|
getBoxes(Class<T> clazz,
boolean recursive)
Gets all child boxes of the given type. |
|
protected void |
getContent(ByteBuffer bb)
Writes the box's content into the given ByteBuffer . |
|
protected long |
getContentSize()
Gets the box's content size. |
|
long |
getNumOfBytesToFirstChild()
The number of bytes from box start (first length byte) to the first length byte of the first child box |
|
void |
parse(ReadableByteChannel in,
ByteBuffer header,
long contentSize,
BoxParser boxParser)
Pareses the given IsoBufferWrapper and returns the remaining bytes. |
|
protected void |
parseChildBoxes(ByteBuffer content)
|
|
void |
removeBox(Box b)
|
|
void |
setBoxes(List<Box> boxes)
Sets all boxes and removes all previous child boxes. |
|
String |
toString()
|
|
protected void |
writeChildBoxes(ByteBuffer bb)
|
Methods inherited from class com.coremedia.iso.boxes.AbstractBox |
---|
getBox, getDeadBytes, getHeader, getIsoFile, getParent, getSize, getType, getUserType, isParsed, parseDetails, setDeadBytes, setParent, setUserType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.coremedia.iso.boxes.ContainerBox |
---|
getIsoFile, getParent |
Methods inherited from interface com.coremedia.iso.boxes.Box |
---|
getBox, getSize, getType, setParent |
Field Detail |
---|
protected List<Box> boxes
protected BoxParser boxParser
Constructor Detail |
---|
public AbstractContainerBox(String type)
Method Detail |
---|
protected long getContentSize()
AbstractBox
getContentSize
in class AbstractBox
public List<Box> getBoxes()
ContainerBox
null
.
getBoxes
in interface ContainerBox
public void setBoxes(List<Box> boxes)
ContainerBox
setBoxes
in interface ContainerBox
boxes
- the new list of childrenpublic <T extends Box> List<T> getBoxes(Class<T> clazz)
ContainerBox
null
.
getBoxes
in interface ContainerBox
clazz
- child box's type
public <T extends Box> List<T> getBoxes(Class<T> clazz, boolean recursive)
ContainerBox
null
.
getBoxes
in interface ContainerBox
clazz
- child box's typerecursive
- step down the tree
public void addBox(Box b)
b
to the container and sets the parent correctly.
b
- will be added to the containerpublic void removeBox(Box b)
public void parse(ReadableByteChannel in, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException
AbstractBox
parse
in interface Box
parse
in class AbstractBox
in
- the (part of the) iso file to parsecontentSize
- expected contentSize of the boxboxParser
- creates inner boxes
IOException
- in case of an I/O error.public void _parseDetails(ByteBuffer content)
AbstractBox
AbstractBox.parseDetails()
which encapsulates the call to this method with some safeguards.
_parseDetails
in class AbstractBox
public String toString()
toString
in class Object
public long getNumOfBytesToFirstChild()
getNumOfBytesToFirstChild
in interface ContainerBox
protected void getContent(ByteBuffer bb) throws IOException
AbstractBox
ByteBuffer
. This must include flags
and version in case of a full box. bb
has been initialized with
getSize()
bytes.
getContent
in class AbstractBox
bb
- the box's content-sink.
IOException
- in case of an exception in the underlying OutputStream
.protected final void parseChildBoxes(ByteBuffer content)
protected final void writeChildBoxes(ByteBuffer bb) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |