Interface RiffChunkType


public interface RiffChunkType
A parsed RIFF chunk. Values of this type are effectively immutable.
  • Method Details

    • parent

      Returns:
      The parent of this RIFF chunk, if one exists
    • name

      RiffChunkID name()
      Returns:
      The chunk ID
    • offset

      long offset()
      Returns:
      The absolute offset in octets of the start of this chunk within the RIFF file
    • dataSizeIncludingForm

      RiffSize dataSizeIncludingForm()
      Returns:
      The size in octets of the data in this chunk, including any form field (if present)
    • totalSize

      default long totalSize()
      Returns:
      The total size of this chunk, including the data (and padding), chunk ID, and chunk size field
    • formType

      Optional<String> formType()
      Returns:
      The form type of this chunk (only applicable to RIFF and LIST chunks).
    • subChunks

      List<RiffChunkType> subChunks()
      Returns:
      A read-only list of subchunks within this chunk (only applicable to RIFF and LIST chunks).
    • dataOffset

      default long dataOffset()
      Returns:
      The absolute offset in octets of the start of this chunk's data within the RIFF file
    • dataOffsetAfterForm

      default long dataOffsetAfterForm()
      Returns:
      The absolute offset in octets of the start of this chunk's data, after any form type field that may be present, within the RIFF file
    • linearizedDescendantChunks

      default Stream<RiffChunkType> linearizedDescendantChunks()
      Returns:
      The linearized subchunks, including all descendants, in depth-first order
    • dataSizeExcludingForm

      default RiffSize dataSizeExcludingForm()
      Returns:
      The size in octets of the data in this chunk, excluding any form field (if present)
    • findRequiredSubChunkWithForm

      default RiffChunkType findRequiredSubChunkWithForm(RiffChunkID id, String form) throws RiffRequiredChunkMissingException
      Find a required subchunk as a direct subchunk of the current chunk. The first matching chunk is returned - subsequent matching chunks are ignored.
      Parameters:
      id - The required ID
      form - The required form
      Returns:
      The chunk
      Throws:
      RiffRequiredChunkMissingException - If no subchunk exists with the given ID and form
    • findRequiredSubChunkWithForm

      default RiffChunkType findRequiredSubChunkWithForm(String id, String form) throws RiffRequiredChunkMissingException
      Find a required subchunk as a direct subchunk of the current chunk. The first matching chunk is returned - subsequent matching chunks are ignored.
      Parameters:
      id - The required ID
      form - The required form
      Returns:
      The chunk
      Throws:
      RiffRequiredChunkMissingException - If no subchunk exists with the given ID and form
    • findRequiredSubChunksWithForm

      default List<RiffChunkType> findRequiredSubChunksWithForm(RiffChunkID id, String form) throws RiffRequiredChunkMissingException
      Find required subchunks as direct subchunks of the current chunk. All matching chunks are returned, and the function raises an exception if no matching chunks are found.
      Parameters:
      id - The required ID
      form - The required form
      Returns:
      The chunks
      Throws:
      RiffRequiredChunkMissingException - If no subchunks exist with the given ID and form
    • findRequiredSubChunksWithForm

      default List<RiffChunkType> findRequiredSubChunksWithForm(String id, String form) throws RiffRequiredChunkMissingException
      Find required subchunks as direct subchunks of the current chunk. All matching chunks are returned, and the function raises an exception if no matching chunks are found.
      Parameters:
      id - The required ID
      form - The required form
      Returns:
      The chunks
      Throws:
      RiffRequiredChunkMissingException - If no subchunks exist with the given ID and form
    • findRequiredSubChunk

      default RiffChunkType findRequiredSubChunk(RiffChunkID id) throws RiffRequiredChunkMissingException
      Find a required subchunk as a direct subchunk of the current chunk. The first matching chunk is returned - subsequent matching chunks are ignored.
      Parameters:
      id - The required ID
      Returns:
      The chunk
      Throws:
      RiffRequiredChunkMissingException - If no subchunk exists with the given ID
    • findRequiredSubChunk

      default RiffChunkType findRequiredSubChunk(String id) throws RiffRequiredChunkMissingException
      Find a required subchunk as a direct subchunk of the current chunk. The first matching chunk is returned - subsequent matching chunks are ignored.
      Parameters:
      id - The required ID
      Returns:
      The chunk
      Throws:
      RiffRequiredChunkMissingException - If no subchunk exists with the given ID
    • findRequiredSubChunks

      default List<RiffChunkType> findRequiredSubChunks(RiffChunkID id) throws RiffRequiredChunkMissingException
      Find required subchunks as direct subchunks of the current chunk. All matching chunks are returned, and the function raises an exception if no matching chunks are found.
      Parameters:
      id - The required ID
      Returns:
      The chunks
      Throws:
      RiffRequiredChunkMissingException - If no subchunks exist with the given ID and form
    • findRequiredSubChunks

      default List<RiffChunkType> findRequiredSubChunks(String id) throws RiffRequiredChunkMissingException
      Find required subchunks as direct subchunks of the current chunk. All matching chunks are returned, and the function raises an exception if no matching chunks are found.
      Parameters:
      id - The required ID
      Returns:
      The chunks
      Throws:
      RiffRequiredChunkMissingException - If no subchunks exist with the given ID and form
    • findOptionalSubChunk

      default Optional<RiffChunkType> findOptionalSubChunk(RiffChunkID id)
      Find an optional subchunk as a direct subchunk of the current chunk. The first matching chunk is returned - subsequent matching chunks are ignored.
      Parameters:
      id - The required ID
      Returns:
      The chunk
    • findOptionalSubChunk

      default Optional<RiffChunkType> findOptionalSubChunk(String id)
      Find an optional subchunk as a direct subchunk of the current chunk. The first matching chunk is returned - subsequent matching chunks are ignored.
      Parameters:
      id - The required ID
      Returns:
      The chunk
    • findOptionalSubChunks

      default Stream<RiffChunkType> findOptionalSubChunks(RiffChunkID id)
      Find optional subchunks as direct subchunks of the current chunk. All matching chunks are returned.
      Parameters:
      id - The required ID
      Returns:
      The chunks
    • findOptionalSubChunks

      default Stream<RiffChunkType> findOptionalSubChunks(String id)
      Find optional subchunks as direct subchunks of the current chunk. All matching chunks are returned.
      Parameters:
      id - The required ID
      Returns:
      The chunks
    • findOptionalSubChunkWithForm

      default Optional<RiffChunkType> findOptionalSubChunkWithForm(RiffChunkID id, String form)
      Find an optional subchunk as a direct subchunk of the current chunk. The first matching chunk is returned - subsequent matching chunks are ignored.
      Parameters:
      id - The required ID
      form - The required form
      Returns:
      The chunk
    • findOptionalSubChunkWithForm

      default Optional<RiffChunkType> findOptionalSubChunkWithForm(String id, String form)
      Find an optional subchunk as a direct subchunk of the current chunk. The first matching chunk is returned - subsequent matching chunks are ignored.
      Parameters:
      id - The required ID
      form - The required form
      Returns:
      The chunk
    • findOptionalSubChunksWithForm

      default Stream<RiffChunkType> findOptionalSubChunksWithForm(RiffChunkID id, String form)
      Find optional subchunks as direct subchunks of the current chunk. All matching chunks are returned.
      Parameters:
      id - The required ID
      form - The required form
      Returns:
      The chunk
    • findOptionalSubChunksWithForm

      default Stream<RiffChunkType> findOptionalSubChunksWithForm(String id, String form)
      Find optional subchunks as direct subchunks of the current chunk. All matching chunks are returned.
      Parameters:
      id - The required ID
      form - The required form
      Returns:
      The chunk
    • matches

      default boolean matches(String id)
      Parameters:
      id - A chunk ID
      Returns:
      true if the current chunk has the given ID
    • matches

      default boolean matches(RiffChunkID id)
      Parameters:
      id - A chunk ID
      Returns:
      true if the current chunk has the given ID
    • matchesWithForm

      default boolean matchesWithForm(RiffChunkID id, String form)
      Parameters:
      id - A chunk ID
      form - A chunk form
      Returns:
      true if the current chunk has the given ID
    • matchesWithForm

      default boolean matchesWithForm(String id, String form)
      Parameters:
      id - A chunk ID
      form - A chunk form
      Returns:
      true if the current chunk has the given ID