Media Authoring
with Java API

tv.amwa.maj.iface
Interface RIFFChunk

All Superinterfaces:
InterchangeObject
All Known Implementing Classes:
RIFFChunk

public interface RIFFChunk
extends InterchangeObject

Specifies a chunk of resource interchange file format (RIFF) data, identified by a 4-byte tag and variable size field.

See the description of the RIFF file format on Wikipedia.

Author:
Richard Cartwright
See Also:
makeRIFFChunk(), BWFImportDescriptor.getUnknownBWFChunks()

Method Summary
 byte[] getChunkData()
          Returns the complete data of this RIFF chunk.
 int getChunkID()
          Returns the chunk id of this RIFF chunk, which is a 4-byte tag that identifies this tag.
 long getLength()
          Returns the total size of this RIFF chunk measured in bytes.
 long getPosition()
          Returns the current position for reading or writing the RIFF chunk data.
 byte[] read(int numberOfBytes)
          Read the requested number of bytes from the RIFF chunk at the current position.
 void setChunkData(byte[] chunkData)
          Sets the complete data of this RIFF chunk and initializes the position to zero.
 void setChunkID(int chunkId)
          Sets the chunk id of this RIFF chunk, which is a 4-byte tag that identifies this tag.
 void setPosition(long offset)
          Sets the position for reading or writing this RIFF chunk data.
 void write(byte[] bytes)
          Writes the given bytes to this RIFF chunk data at the current position.
 
Methods inherited from interface tv.amwa.maj.iface.InterchangeObject
countProperties, createOptionalPropertyValue, disableGenerationTracking, enableGenerationTracking, getDefinition, getGeneration, getGenerationAUID, getProperties, getPropertyValue, isGenerationTracked, isPropertyPresent, omitOpionalProperty, setPropertyValue
 

Method Detail

setChunkID

void setChunkID(@UInt32
                int chunkId)

Sets the chunk id of this RIFF chunk, which is a 4-byte tag that identifies this tag.

Note that in the representation of this tag, care needs to be taken to ensure that the sign bit is not confused with an 8-bit character code. Negative values are accepted by this method.

Parameters:
chunkId - Chunk identifier for this RIFF chunk.

getChunkID

@UInt32
int getChunkID()

Returns the chunk id of this RIFF chunk, which is a 4-byte tag that identifies this tag.

Note that in the representation of this tag, care needs to be taken to ensure that the sign bit is not confused with an 8-bit character code. Negative values are accepted by this method.

Returns:
Chunk identifier for this RIFF chunk.

read

@DataBuffer
byte[] read(@UInt32
                       int numberOfBytes)
            throws IllegalArgumentException,
                   EndOfDataException

Read the requested number of bytes from the RIFF chunk at the current position. The position is advanced by the number of bytes read.

Parameters:
numberOfBytes - Number of bytes to read from the RIFF chunk.
Returns:
Bytes read from the RIFF chunk at the current position.
Throws:
IllegalArgumentException - Cannot read a negative number of bytes.
EndOfDataException - The number of bytes requested are not available in the RIFF chunk relative to the current position.
See Also:
getPosition()

write

void write(@DataBuffer
           byte[] bytes)
           throws NullPointerException,
                  EndOfDataException

Writes the given bytes to this RIFF chunk data at the current position. The position is advanced by the number of bytes written. Any data beyond the new position is lost by truncating the buffer.

Parameters:
bytes - Bytes to write to the RIFF chunk data.
Throws:
NullPointerException - The given array of bytes is null.
EndOfDataException - The size of the RIFF chunk is less than the number of bytes to write relative to the current position.
See Also:
getPosition()

setPosition

void setPosition(@PositionType
                 long offset)
                 throws PositionOutOfRangeException

Sets the position for reading or writing this RIFF chunk data.

Parameters:
offset - Position offset to set for reading or writing RIFF chunk data.
Throws:
PositionOutOfRangeException - The given offset is outside the acceptable range for this RIFF chunk data, which is between 0 and the length of the data.
See Also:
getLength()

getPosition

@PositionType
long getPosition()

Returns the current position for reading or writing the RIFF chunk data.

Returns:
Current position for reading or writing the RIFF chunk data.

getLength

@LengthType
long getLength()

Returns the total size of this RIFF chunk measured in bytes. The length is initially 0 until setChunkData(byte[]) has been called.

Returns:
Total size size of this RIFF chunk measured in bytes.

getChunkData

@DataBuffer
byte[] getChunkData()

Returns the complete data of this RIFF chunk.

Returns:
Actual data of this RIFF chunk.

setChunkData

void setChunkData(@DataBuffer
                  byte[] chunkData)
                  throws NullPointerException

Sets the complete data of this RIFF chunk and initializes the position to zero. The length property of this RIFF chunk will be set to the length of the given chunk data.

Parameters:
chunkData - Actual data for this RIFF chunk.
Throws:
NullPointerException - The chunk data argument is null.

Media Authoring
with Java API

(c) 2007-2008 Richard Cartwright, all rights reserved. Subject to the terms of the AAF SDK Public Source License.