Maven module :un.storage : media-mpeg4 :
Class : un.storage.media.mp4.boxes.Box
Extends/Implements : un.api.CObject
Subclasses : -

MP4 Box (also called Atom).
author  Johann Sorel
author  Alexander Simm


Variables : parent, type, size, offset, children
Functions : Box, Box, Box, setParams, getParent, setParent, getSize, getType, getOffset, getFourCC, getName, hasChildren, hasChild, getChildren, getChildren, getChild, read, write, toChars, getLeft, decode, readChildren, readChildren


protected Box parent

protected long type


Box size in bytes, including name (4bytes) and size (4bytes)
protected long size


Box offset from file start in bytes.
protected long offset

protected Sequence children


public void Box ()

public void Box (String name)

public void Box (long type, long size, long offset)

public void setParams (Box parent, long size, long type, long offset)

public Box getParent ()

public void setParent (Box parent)


Returns the size of this box including its header.
return  this box's size
public long getSize ()


Returns the type of this box as a 4CC converted to a long.
return  this box's type
public long getType ()


Returns the offset of this box in the stream/file. This is needed as a
seek point for random access.
return  this box's offset
public long getOffset ()


Returns the FourCC typeof this box as a human-readable string
(e.g. "moov").

@return this box's fourCC
public Chars getFourCC ()


Returns the name of this box as a human-readable string
(e.g. "Track Header Box").

@return this box's name
public Chars getName ()


Indicates if this box has children.
return  true if this box contains at least one child
public boolean hasChildren ()


Indicated if the box has a child with the given type.
param  type the type of child box to look for
return  true if this box contains at least one child with the given type
public boolean hasChild (long type)


Returns an ordered and unmodifiable list of all direct children of this
box. The list does not contain the children's children.

@return this box's children
public Sequence getChildren ()


Returns an ordered and unmodifiable list of all direct children of this
box with the specified type. The list does not contain the children's
children. If there is no child with the given type, the list will be
empty.

@param type the type of child boxes to look for
@return this box's children with the given type
public Sequence getChildren (long type)


Returns the child box with the specified type. If this box has no child
with the given type, null is returned. To check if there is such a child
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).

@param type the type of child box to look for
@return the first child box with the given type, or null if none is found
public Box getChild (long type)

public void read (DataInputStream ds)

public void write (DataOutputStream ds)

public Chars toChars ()

protected long getLeft (MP4InputStream in)


Decodes the given input stream by reading this box and all of its
children (if any).
param  in an input stream
throws  IOException if an error occurs while reading
public void decode (MP4InputStream in)

public void readChildren (MP4InputStream in)

protected void readChildren (MP4InputStream in, int number)