class StdioByteStream: public ByteStream

ByteStream interface for stdio files.

Inheritance:


Public Methods

[more] StdioByteStream(const char *filename, const char *mode="rb")
Constructs a ByteStream for accessing the file named filename.
[more] StdioByteStream(FILE *f, const char *mode="rb", bool closeme=false)
Constructs a ByteStream for accessing the stdio file f.


Inherited from ByteStream:

Public

Virtual Functions.

[more]virtual ~ByteStream()
Virtual destructor.
[more]virtual size_t read(void *buffer, size_t size)
Reads data from a ByteStream.
[more]virtual size_t write(const void *buffer, size_t size)
Writes data to a ByteStream.
[more]virtual long tell(void) const
Returns the offset of the current position in the ByteStream.
[more]virtual int seek(long offset, int whence = SEEK_SET, bool nothrow=false)
Sets the current position for reading or writing the ByteStream.
[more]virtual void flush(void)
Flushes all buffers in the ByteStream.

Utility Functions.

[more]size_t readall(void *buffer, size_t size)
Reads data and blocks until everything has been read.
[more]size_t writall(const void *buffer, size_t size)
Writes data and blocks until everything has been written.
[more]size_t copy(ByteStream &bsfrom, size_t size=0)
Copy data from another ByteStream.
[more]void write8(unsigned int card8)
Writes a one-byte integer to a ByteStream.
[more]void write16(unsigned int card16)
Writes a two-bytes integer to a ByteStream.
[more]void write24(unsigned int card24)
Writes a three-bytes integer to a ByteStream.
[more]void write32(unsigned int card32)
Writes a four-bytes integer to a ByteStream.
[more]unsigned int read8()
Reads a one-byte integer from a ByteStream.
[more]unsigned int read16()
Reads a two-bytes integer from a ByteStream.
[more]unsigned int read24()
Reads a three-bytes integer from a ByteStream.
[more]unsigned int read32()
Reads a four-bytes integer from a ByteStream.
[more]virtual int size(void) const
Returns the total number of bytes contained in the buffer, file, etc.


Inherited from GPEnabled:

Public Methods

oGPEnabled& operator=(const GPEnabled & obj)
oint get_count(void) const

Protected Fields

ovolatile int count


Documentation

ByteStream interface for stdio files. The virtual member functions read, write, tell and seek are mapped to the well known stdio functions fread, fwrite, ftell and fseek.
o StdioByteStream(const char *filename, const char *mode="rb")
Constructs a ByteStream for accessing the file named filename. Arguments filename and mode are similar to the arguments of the well known stdio function fopen. In addition a filename of - will be interpreted as the standard output or the standard input according to mode. This constructor will open a stdio file and construct a ByteStream object accessing this file. Destroying the ByteStream object will flush and close the associated stdio file. Exception GException is thrown with a plain text error message if the stdio file cannot be opened.

o StdioByteStream(FILE *f, const char *mode="rb", bool closeme=false)
Constructs a ByteStream for accessing the stdio file f. Argument mode indicates the type of the stdio file, as in the well known stdio function fopen. Destroying the ByteStream object will not close the stdio file f unless closeme is true.


This class has no child classes.
See Also:
Unix man page fopen(3), fread(3), fwrite(3), ftell(3), fseek(3)

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.