Package org.mp4parser

Class BasicContainer

java.lang.Object
org.mp4parser.BasicContainer
All Implemented Interfaces:
Container
Direct Known Subclasses:
AbstractContainerBox, IsoFile

public class BasicContainer extends Object implements Container
  • Constructor Details

    • BasicContainer

      public BasicContainer()
    • BasicContainer

      public BasicContainer(List<Box> boxes)
  • Method Details

    • getBoxes

      public List<Box> getBoxes()
      Description copied from interface: Container
      Gets all child boxes. May not return null.
      Specified by:
      getBoxes in interface Container
      Returns:
      an array of boxes, empty array in case of no children.
    • setBoxes

      public void setBoxes(List<? extends Box> boxes)
      Description copied from interface: Container
      Sets all boxes and removes all previous child boxes.
      Specified by:
      setBoxes in interface Container
      Parameters:
      boxes - the new list of children
    • getContainerSize

      protected long getContainerSize()
    • getBoxes

      public <T extends Box> List<T> getBoxes(Class<T> clazz)
      Description copied from interface: Container
      Gets all child boxes of the given type. May not return null.
      Specified by:
      getBoxes in interface Container
      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.
    • getBoxes

      public <T extends Box> List<T> getBoxes(Class<T> clazz, boolean recursive)
      Description copied from interface: Container
      Gets all child boxes of the given type. May not return null.
      Specified by:
      getBoxes in interface Container
      Type Parameters:
      T - type of boxes to get
      Parameters:
      clazz - child box's type
      recursive - step down the tree
      Returns:
      an array of boxes, empty array in case of no children.
    • addBox

      public void addBox(Box box)
      Add box to the container and sets the parent correctly. If box is null nochange will be performed and no error thrown.
      Parameters:
      box - will be added to the container
    • initContainer

      public void initContainer(ReadableByteChannel readableByteChannel, long containerSize, BoxParser boxParser) throws IOException
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writeContainer

      public final void writeContainer(WritableByteChannel bb) throws IOException
      Specified by:
      writeContainer in interface Container
      Throws:
      IOException