Class AbstractBox

    • Constructor Detail

      • AbstractBox

        protected AbstractBox​(String type)
      • AbstractBox

        protected AbstractBox​(String type,
                              byte[] userType)
    • Method Detail

      • getContentSize

        protected abstract long getContentSize()
        Get the box's content size without its header. This must be the exact number of bytes that getContent(ByteBuffer) writes.
        Returns:
        Gets the box's content size in bytes
        See Also:
        getContent(java.nio.ByteBuffer)
      • getContent

        protected abstract void getContent​(ByteBuffer byteBuffer)
        Write the box's content into the given ByteBuffer. This must include flags and version in case of a full box. byteBuffer has been initialized with getSize() bytes.
        Parameters:
        byteBuffer - the sink for the box's content
      • _parseDetails

        protected abstract void _parseDetails​(ByteBuffer content)
        Parse the box's fields and child boxes if any.
        Parameters:
        content - the box's raw content beginning after the 4-cc field.
      • parse

        @DoNotParseDetail
        public void parse​(ReadableByteChannel dataSource,
                          ByteBuffer header,
                          long contentSize,
                          BoxParser boxParser)
                   throws IOException
        Parses the box excluding the already parsed header (size, 4cc, [long-size], [user-type]). The remaining size of the box is the contentSize, contentSize number of bytes should be read from the box source (readableByteChannel). If you need the header buffer at a later stage you have to create a copy.
        Specified by:
        parse in interface ParsableBox
        Parameters:
        dataSource - the source for this box
        header - the box' already parsed header (create copy if you need it later as it will be overwritten)
        contentSize - remaining bytes of this box
        boxParser - use it to parse sub-boxes.
        Throws:
        IOException - in case of an error during a read operation
      • getBox

        public void getBox​(WritableByteChannel os)
                    throws IOException
        Description copied from interface: Box
        Writes the complete box - size | 4-cc | content - to the given writableByteChannel.
        Specified by:
        getBox in interface Box
        Parameters:
        os - the box's sink
        Throws:
        IOException - in case of problems with the Channel
      • parseDetails

        public final void parseDetails()
        Parses the raw content of the box. It surrounds the actual parsing which is done
      • getSize

        public long getSize()
        Gets the full size of the box including header and content.
        Specified by:
        getSize in interface Box
        Returns:
        the box's size
      • getType

        @DoNotParseDetail
        public String getType()
        Description copied from interface: Box
        The box's 4-cc type.
        Specified by:
        getType in interface Box
        Returns:
        the 4 character type of the box
      • isParsed

        public boolean isParsed()
        Check if details are parsed.
        Returns:
        true whenever the content ByteBuffer is not null