Abstract class for a stream of bytes.
Abstract class for a stream of bytes. Class ByteStream represent an object from which (resp. to which) bytes can be read (resp. written) as with a regular file. Virtual functions read and write must implement these two basic operations. In addition, function tell returns an offset identifying the current position, and function seek may be used to change the current position.Note. Both the copy constructor and the copy operator are declared as private members. It is therefore not possible to make multiple copies of instances of this class, as implied by the class semantic.
Error reporting:
If seek() succeeds, 0 is returned. Otherwise it either returns
-1 (if nothrow is set to FALSE) or throws the GException
exception.
virtual size_t read(void *buffer, size_t size)
virtual size_t write(const void *buffer, size_t size)
virtual long tell(void) const
virtual int seek(long offset, int whence = SEEK_SET, bool nothrow=false)
Results are undefined whenever the new position is greater than the
total size of the ByteStream.virtual void flush(void)
size_t writall(const void *buffer, size_t size)
size_t copy(ByteStream &bsfrom, size_t size=0)
void write8(unsigned int card8)
void write16(unsigned int card16)
void write24(unsigned int card24)
void write32(unsigned int card32)
unsigned int read8()
unsigned int read16()
unsigned int read24()
unsigned int read32()
virtual int size(void) const
TArray<char> get_data(void)
virtual size_t readat(void *buffer, size_t sz, int pos)
static GP<ByteStream> create(void const * const buffer, const size_t size)
static GP<ByteStream> create( const char filename[], char const * const mode)
static GP<ByteStream> create( const int fd, char const * const mode, const bool closeme)
static GP<ByteStream> create( FILE * const f, char const * const mode, const bool closeme)
static GP<ByteStream> create_static( void const * const buffer, const size_t size)
Alphabetic index HTML hierarchy of classes or Java