Package com.io7m.jspiel.api
Interface RiffChunkType
public interface RiffChunkType
A parsed RIFF chunk. Values of this type are effectively immutable.
-
Method Summary
Modifier and TypeMethodDescriptiondefault long
default long
default RiffSize
default Optional<RiffChunkType>
Find an optional subchunk as a direct subchunk of the current chunk.default Optional<RiffChunkType>
Find an optional subchunk as a direct subchunk of the current chunk.default Stream<RiffChunkType>
Find optional subchunks as direct subchunks of the current chunk.default Stream<RiffChunkType>
Find optional subchunks as direct subchunks of the current chunk.default Stream<RiffChunkType>
findOptionalSubChunksWithForm
(RiffChunkID id, String form) Find optional subchunks as direct subchunks of the current chunk.default Stream<RiffChunkType>
findOptionalSubChunksWithForm
(String id, String form) Find optional subchunks as direct subchunks of the current chunk.default Optional<RiffChunkType>
findOptionalSubChunkWithForm
(RiffChunkID id, String form) Find an optional subchunk as a direct subchunk of the current chunk.default Optional<RiffChunkType>
findOptionalSubChunkWithForm
(String id, String form) Find an optional subchunk as a direct subchunk of the current chunk.default RiffChunkType
Find a required subchunk as a direct subchunk of the current chunk.default RiffChunkType
Find a required subchunk as a direct subchunk of the current chunk.default List<RiffChunkType>
Find required subchunks as direct subchunks of the current chunk.default List<RiffChunkType>
Find required subchunks as direct subchunks of the current chunk.default List<RiffChunkType>
findRequiredSubChunksWithForm
(RiffChunkID id, String form) Find required subchunks as direct subchunks of the current chunk.default List<RiffChunkType>
findRequiredSubChunksWithForm
(String id, String form) Find required subchunks as direct subchunks of the current chunk.default RiffChunkType
findRequiredSubChunkWithForm
(RiffChunkID id, String form) Find a required subchunk as a direct subchunk of the current chunk.default RiffChunkType
findRequiredSubChunkWithForm
(String id, String form) Find a required subchunk as a direct subchunk of the current chunk.formType()
default Stream<RiffChunkType>
default boolean
matches
(RiffChunkID id) default boolean
default boolean
matchesWithForm
(RiffChunkID id, String form) default boolean
matchesWithForm
(String id, String form) name()
long
offset()
parent()
default long
-
Method Details
-
parent
Optional<RiffChunkType> 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
- Returns:
- The form type of this chunk (only applicable to
RIFF
andLIST
chunks).
-
subChunks
List<RiffChunkType> subChunks()- Returns:
- A read-only list of subchunks within this chunk (only applicable to
RIFF
andLIST
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
- Returns:
- The linearized subchunks, including all descendants, in depth-first order
-
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 IDform
- 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 IDform
- 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 IDform
- 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 IDform
- The required form- Returns:
- The chunks
- Throws:
RiffRequiredChunkMissingException
- If no subchunks exist with the given ID and form
-
findRequiredSubChunk
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
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
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
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
Find optional subchunks as direct subchunks of the current chunk. All matching chunks are returned.- Parameters:
id
- The required ID- Returns:
- The chunks
-
findOptionalSubChunks
Find optional subchunks as direct subchunks of the current chunk. All matching chunks are returned.- Parameters:
id
- The required ID- Returns:
- The chunks
-
findOptionalSubChunkWithForm
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 IDform
- The required form- Returns:
- The chunk
-
findOptionalSubChunkWithForm
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 IDform
- The required form- Returns:
- The chunk
-
findOptionalSubChunksWithForm
Find optional subchunks as direct subchunks of the current chunk. All matching chunks are returned.- Parameters:
id
- The required IDform
- The required form- Returns:
- The chunk
-
findOptionalSubChunksWithForm
Find optional subchunks as direct subchunks of the current chunk. All matching chunks are returned.- Parameters:
id
- The required IDform
- The required form- Returns:
- The chunk
-
matches
- Parameters:
id
- A chunk ID- Returns:
true
if the current chunk has the given ID
-
matches
- Parameters:
id
- A chunk ID- Returns:
true
if the current chunk has the given ID
-
matchesWithForm
- Parameters:
id
- A chunk IDform
- A chunk form- Returns:
true
if the current chunk has the given ID
-
matchesWithForm
- Parameters:
id
- A chunk IDform
- A chunk form- Returns:
true
if the current chunk has the given ID
-