@MediaClass(uuid1=218169601, uuid2=257, uuid3=20224, uuid4={6,14,43,52,2,6,1,1}, definedName="RIFFChunk", description="Chunk of data as defined by the Resource Interchange File Format (RIFF).", symbol="RIFFChunk") public class RIFFChunkImpl extends InterchangeObjectImpl implements RIFFChunk, Serializable, XMLSerializable, Cloneable
Implements the representation of a chunk of resource interchange file format (RIFF) data, identified by a 4-byte tag and variable size field.
ObjectClassPropertyID| Constructor and Description |
|---|
RIFFChunkImpl() |
RIFFChunkImpl(int chunkID)
Creates and initializes a new RIFF data chunk with the given chunk identifier.
|
| Modifier and Type | Method and Description |
|---|---|
RIFFChunk |
clone()
Create a cloned copy of this interchange object.
|
Stream |
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.
|
String |
getComment()
Include a comment when serializing a value to XML.
|
int |
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.
|
static Stream |
initializeChunkData() |
static int |
initializeChunkID() |
static long |
initializeChunkLength() |
ByteBuffer |
read(int numberOfBytes)
Read the requested number of bytes from the RIFF chunk at the current position.
|
void |
setChunkData(Stream 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 |
setChunkLength(long chunkLength) |
void |
setPosition(long offset)
Sets the position for reading or writing this RIFF chunk data.
|
void |
write(ByteBuffer bytes)
Writes the given bytes to this RIFF chunk data at the current position.
|
addApplicationPlugin, appendXMLChildren, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getLinkedGenerationIDString, getObjectClass, getPersistentID, getPersistentIndex, hashCode, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setLinkedGenerationIDString, setObjectClass, setPersistentID, setPersistentIndex, toStringaddApplicationPlugin, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getObjectClass, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setObjectClass, toStringgetPersistentID, setPersistentIndexappendXMLChildrenpublic RIFFChunkImpl()
public RIFFChunkImpl(@UInt32 int chunkID)
Creates and initializes a new RIFF data chunk with the given chunk identifier. The identifier is used to represent 4 ASCII characters that represent the kind of data stored inside the chunk.
chunkID - Identifier for the new chunk.@MediaProperty(uuid1=67568640, uuid2=0, uuid3=0, uuid4={6,14,43,52,1,1,1,8}, definedName="ChunkData", typeName="Stream", optional=false, uniqueIdentifier=false, pid=20227, symbol="ChunkData") public Stream getChunkData()
RIFFChunkReturns the complete data of this RIFF chunk.
getChunkData in interface RIFFChunk@MediaPropertySetter(value="ChunkData") public void setChunkData(Stream chunkData) throws NullPointerException
RIFFChunkSets 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.
setChunkData in interface RIFFChunkchunkData - Actual data for this RIFF chunk.NullPointerException - The chunk data argument is null.public static final Stream initializeChunkData()
@MediaProperty(uuid1=67504130, uuid2=0, uuid3=0, uuid4={6,14,43,52,1,1,1,8}, definedName="ChunkID", typeName="UInt32", optional=false, uniqueIdentifier=false, pid=20225, symbol="ChunkID") public int getChunkID()
RIFFChunkReturns 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.
getChunkID in interface RIFFChunk@MediaPropertySetter(value="ChunkID") public void setChunkID(int chunkID)
RIFFChunkSets 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.
setChunkID in interface RIFFChunkchunkID - Chunk identifier for this RIFF chunk.public static final int initializeChunkID()
@MediaProperty(uuid1=67504387, uuid2=0, uuid3=0, uuid4={6,14,43,52,1,1,1,8}, definedName="ChunkLength", typeName="UInt32", optional=false, uniqueIdentifier=false, pid=20226, symbol="ChunkLength") public int getLength()
RIFFChunkReturns the total size of this RIFF chunk measured in bytes. The length is
initially 0 until RIFFChunk.setChunkData(Stream) has been called.
@MediaPropertySetter(value="ChunkLength") public void setChunkLength(long chunkLength) throws IllegalArgumentException
IllegalArgumentExceptionpublic static final long initializeChunkLength()
public long getPosition()
throws IOException
RIFFChunkReturns the current position for reading or writing the RIFF chunk data.
getPosition in interface RIFFChunkIOException - Error occurred when trying to set the position for the
underlying stream.public void setPosition(long offset)
throws PositionOutOfRangeException,
IOException
RIFFChunkSets the position for reading or writing this RIFF chunk data.
setPosition in interface RIFFChunkoffset - Position offset to set for reading or writing RIFF chunk data.PositionOutOfRangeException - The given offset is outside the acceptable
range for this RIFF chunk data, which is between 0 and the length of the data.IOException - Error occurred when trying to set the position for the
underlying stream.RIFFChunk.getLength()public ByteBuffer read(int numberOfBytes) throws IllegalArgumentException, EndOfDataException, IOException
RIFFChunkRead the requested number of bytes from the RIFF chunk at the current position. The position is advanced by the number of bytes read.
read in interface RIFFChunknumberOfBytes - Number of bytes to read from the RIFF chunk.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.IOException - Error occurred when trying to read from the underlying
stream.RIFFChunk.getPosition()public void write(ByteBuffer bytes) throws NullPointerException, EndOfDataException, IOException
RIFFChunkWrites 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.
write in interface RIFFChunkbytes - Bytes to write to the RIFF chunk data.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.IOException - Error occurred when trying to write to the underlying stream.RIFFChunk.getPosition()public RIFFChunk clone()
InterchangeObjectCreate a cloned copy of this interchange object.
clone in interface MediaEntityclone in interface InterchangeObjectclone in interface RIFFChunkclone in class InterchangeObjectImplpublic String getComment()
XMLSerializableInclude a comment when serializing a value to XML. The comment will be inserted as the first child node of the element representing the class.
getComment in interface XMLSerializablegetComment in class InterchangeObjectImpl(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.