Package org.mp4parser.support
Class FullContainerBox
- java.lang.Object
-
- org.mp4parser.BasicContainer
-
- org.mp4parser.support.AbstractContainerBox
-
- org.mp4parser.support.FullContainerBox
-
- All Implemented Interfaces:
Box,Container,FullBox,ParsableBox
public abstract class FullContainerBox extends AbstractContainerBox implements FullBox
Abstract base class for a full tools box only containing ither boxes.
-
-
Field Summary
-
Fields inherited from class org.mp4parser.support.AbstractContainerBox
largeBox, type
-
-
Constructor Summary
Constructors Constructor Description FullContainerBox(String type)
-
Method Summary
Modifier and Type Method Description voidgetBox(WritableByteChannel writableByteChannel)Writes the complete box - size | 4-cc | content - to the givenwritableByteChannel.<T extends Box>
List<T>getBoxes(Class<T> clazz)Gets all child boxes of the given type.intgetFlags()protected ByteBuffergetHeader()intgetVersion()voidparse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser)Parses the box excluding the already parsed header (size, 4cc, [long-size], [user-type]).protected longparseVersionAndFlags(ByteBuffer content)Parses the version/flags header and returns the remaining box size.voidsetFlags(int flags)voidsetVersion(int version)StringtoString()protected voidwriteVersionAndFlags(ByteBuffer bb)-
Methods inherited from class org.mp4parser.support.AbstractContainerBox
getSize, getType, setParent
-
Methods inherited from class org.mp4parser.BasicContainer
addBox, getBoxes, getBoxes, getContainerSize, initContainer, setBoxes, writeContainer
-
-
-
-
Constructor Detail
-
FullContainerBox
public FullContainerBox(String type)
-
-
Method Detail
-
getVersion
public int getVersion()
- Specified by:
getVersionin interfaceFullBox
-
setVersion
public void setVersion(int version)
- Specified by:
setVersionin interfaceFullBox
-
getBoxes
public <T extends Box> List<T> getBoxes(Class<T> clazz)
Description copied from interface:ContainerGets all child boxes of the given type. May not returnnull.- Specified by:
getBoxesin interfaceContainer- Overrides:
getBoxesin classBasicContainer- Type Parameters:
T- type of boxes to get- Parameters:
clazz- child box's type- Returns:
- an array of boxes, empty array in case of no children.
-
parse
public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException
Description copied from interface:ParsableBoxParses the box excluding the already parsed header (size, 4cc, [long-size], [user-type]). The remaining size of the box is thecontentSize,contentSizenumber of bytes should be read from the box source (readableByteChannel). If you need theheaderbuffer at a later stage you have to create a copy.- Specified by:
parsein interfaceParsableBox- Overrides:
parsein classAbstractContainerBox- Parameters:
dataSource- the source for this boxheader- the box' already parsed header (create copy if you need it later as it will be overwritten)contentSize- remaining bytes of this boxboxParser- use it to parse sub-boxes.- Throws:
IOException- in case of an error during a read operation
-
getBox
public void getBox(WritableByteChannel writableByteChannel) throws IOException
Description copied from interface:BoxWrites the complete box - size | 4-cc | content - to the givenwritableByteChannel.- Specified by:
getBoxin interfaceBox- Overrides:
getBoxin classAbstractContainerBox- Parameters:
writableByteChannel- the box's sink- Throws:
IOException- in case of problems with theChannel
-
toString
public String toString()
- Overrides:
toStringin classBasicContainer
-
parseVersionAndFlags
protected final long parseVersionAndFlags(ByteBuffer content)
Parses the version/flags header and returns the remaining box size.- Parameters:
content- theByteBufferthat contains the version & flag- Returns:
- number of bytes read
-
writeVersionAndFlags
protected final void writeVersionAndFlags(ByteBuffer bb)
-
getHeader
protected ByteBuffer getHeader()
- Overrides:
getHeaderin classAbstractContainerBox
-
-