public class BoxImpl extends java.lang.Object implements Box
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Box> |
children |
protected long |
offset |
protected Box |
parent |
protected long |
size |
protected long |
type |
Constructor and Description |
---|
BoxImpl(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
decode(MP4InputStream in)
Decodes the given input stream by reading this box and all of its
children (if any).
|
Box |
getChild(long type)
Returns the child box with the specified type.
|
java.util.List<Box> |
getChildren()
Returns an ordered and unmodifiable list of all direct children of this
box.
|
java.util.List<Box> |
getChildren(long type)
Returns an ordered and unmodifiable list of all direct children of this
box with the specified type.
|
protected long |
getLeft(MP4InputStream in) |
java.lang.String |
getName()
Returns the name of this box as a human-readable string
(e.g.
|
long |
getOffset()
Returns the offset of this box in the stream/file.
|
Box |
getParent() |
long |
getSize()
Returns the size of this box including its header.
|
long |
getType()
Returns the type of this box as a 4CC converted to a long.
|
boolean |
hasChild(long type)
Indicated if the box has a child with the given type.
|
boolean |
hasChildren()
Indicates if this box has children.
|
protected void |
readChildren(MP4InputStream in) |
protected void |
readChildren(MP4InputStream in,
int len) |
void |
setParams(Box parent,
long size,
long type,
long offset) |
java.lang.String |
toString() |
protected long size
protected long type
protected long offset
protected Box parent
protected final java.util.List<Box> children
public void setParams(Box parent, long size, long type, long offset)
protected long getLeft(MP4InputStream in) throws java.io.IOException
java.io.IOException
public void decode(MP4InputStream in) throws java.io.IOException
in
- an input streamjava.io.IOException
- if an error occurs while readingpublic long getType()
Box
public long getSize()
Box
public long getOffset()
Box
public java.lang.String getName()
Box
public java.lang.String toString()
toString
in class java.lang.Object
public boolean hasChildren()
Box
hasChildren
in interface Box
public boolean hasChild(long type)
Box
public Box getChild(long type)
Box
hasChild(type)
can be used.
If more than one child exists with the same type, the first one will
always be returned. A list of all children with that type can be received
via getChildren(type)
.public java.util.List<Box> getChildren()
Box
getChildren
in interface Box
public java.util.List<Box> getChildren(long type)
Box
getChildren
in interface Box
type
- the type of child boxes to look forprotected void readChildren(MP4InputStream in) throws java.io.IOException
java.io.IOException
protected void readChildren(MP4InputStream in, int len) throws java.io.IOException
java.io.IOException