ByteStream interface for an IFF file.
class Stdioclass Staticclass Memoryclass Virtual Functions.
Utility Functions.
ByteStream interface for an IFF file.Class IFFByteStream augments the ByteStream interface with functions for navigating from chunk to chunk. It works in relation with a ByteStream specified at construction time.
Reading an IFF file --- You can read an IFF file by constructing an IFFByteStream object attached to the ByteStream containing the IFF file. Calling function get_chunk positions the file pointer at the beginning of the first chunk. You can then use read to access the chunk data. Function read will return 0 if you attempt to read past the end of the chunk, just as if you were trying to read past the end of a file. You can at any time call function close_chunk to terminate reading data in this chunk. The following chunks can be accessed by calling get_chunk and close_chunk repeatedly until you reach the end of the file. Function read is not very useful when accessing a composite chunk. You can instead make nested calls to functions get_chunk and close_chunk in order to access the chunks located inside the composite chunk.
Writing an IFF file --- You can write an IFF file by constructing an IFFByteStream object attached to the seekable ByteStream object that will contain the IFF file. Calling function put_chunk creates a first chunk header and positions the file pointer at the beginning of the chunk. You can then use write to store the chunk data. Calling function close_chunk terminates the current chunk. You can append more chunks by calling put_chunk and close_chunk repeatedly. Function write is not very useful for writing a composite chunk. You can instead make nested calls to function put_chunk and close_chunk in order to create chunks located inside the composite chunk.
Writing an IFF file requires a seekable ByteStream (see ByteStream::is_seekable). This is not much of a problem because you can always create the IFF file into a MemoryByteStream and then use copy to transfer the IFF file into a non seekable ByteStream.
0x41, 0x54, 0x26, 0x54 before the chunk header, as discussed in
IFFByteStream.h.
int get_chunk(GString &chkid, int *rawoffsetptr=0, int *rawsizeptr=0)
void put_chunk(const char *chkid, int insertmagic=0)
void close_chunk()
void seek_close_chunk()
int ready()
int composite()
void short_id(GString &chkid)
void full_id(GString &chkid)
static int check_id(const char *id)
bool has_magic
Alphabetic index HTML hierarchy of classes or Java