Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

IFFByteStream Class Reference

#include <IFFByteStream.h>

List of all members.


Detailed Description

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 {ByteStream::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 {ByteStream::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 {ByteStream::copy} to transfer the IFF file into a non seekable ByteStream.

Definition at line 183 of file IFFByteStream.h.


Public Member Functions

void close_chunk ()
bool compare (IFFByteStream &iff)
int composite ()
size_t copy (ByteStream &bsfrom, size_t size=0)
virtual void flush (void)
void full_id (GUTF8String &chkid)
GP< ByteStreamget_bytestream (void)
int get_chunk (GUTF8String &chkid, int *rawoffsetptr=0, int *rawsizeptr=0)
void put_chunk (const char *chkid, int insertmagic=0)
virtual size_t read (void *buffer, size_t size)
int ready ()
void seek_close_chunk ()
void short_id (GUTF8String &chkid)
virtual long tell (void) const
virtual size_t write (const void *buffer, size_t size)

Static Public Member Functions

static int check_id (const char *id)
static GP< IFFByteStreamcreate (const GP< ByteStream > &bs)

Public Attributes

bool has_magic_att
bool has_magic_sdjv

Protected Member Functions

 IFFByteStream (const GP< ByteStream > &bs, const int pos)

Private Member Functions

 IFFByteStream (const IFFByteStream &)
IFFByteStreamoperator= (const IFFByteStream &)

Static Private Member Functions

static GP< IFFByteStreamcreate (ByteStream *bs)

Private Attributes

IFFContext * ctx
int dir
long offset
long seekto

Classes

struct  IFFContext

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index