Logo Search packages:      
Sourcecode: djvulibre version File versions

size_t ByteStream::read ( void *  buffer,
size_t  size 
) [virtual]

Reads data from a ByteStream. This function {must} be implemented by each subclass of ByteStream#. At most size# bytes are read from the ByteStream and stored in the memory area pointed to by buffer#. Function read# returns immediately if size# is zero. The actual number of bytes read is returned. Function read# returns a number of bytes smaller than size# if the end-of-file mark is reached before filling the buffer. Subsequent invocations will always return value #0#. Function read# may also return a value greater than zero but smaller than size# for internal reasons. Programs must be ready to handle these cases or use function {readall}. Exception {GException} is thrown with a plain text error message whenever an error occurs.

Reimplemented in ByteStream::Stdio, ByteStream::Memory, ByteStream::Static, and UnicodeByteStream.

Definition at line 327 of file ByteStream.cpp.

Referenced by DataPool::connect(), copy(), DjVuTXT::decode(), DjVuNavDir::decode(), DjVuImage::decode(), DjVmDir0::decode(), DjVmDir::decode(), DjVuANT::encode_raw(), DjVmDoc::insert_file(), DjVmDoc::read(), readall(), and seek().

  G_THROW( ERR_MSG("ByteStream.cant_read") );      //  Cannot read from a ByteStream created for writing
  return 0;

Generated by  Doxygen 1.6.0   Back to index