Logo Search packages:      
Sourcecode: djvulibre version File versions

int DataPool::get_data ( void *  buffer,
int  offset,
int  size 

Attempts to return a block of data at the given offset# of the given size#.

{enumerate} If the DataPool# is connected to another DataPool# or to a file, the request will just be forwarded to them. If the DataPool# is not connected to anything and some of the data requested is in the internal buffer, the function copies available data to buffer# and returns immediately.

If there is no data available, and {is_eof}() returns FALSE#, the reader (and the thread) will be { blocked} until the data actually arrives. Please note, that since the reader is blocked, it should run in a separate thread so that other threads have a chance to call {add_data}(). If there is no data available, but {is_eof}() is TRUE# the behavior is different and depends on the DataPool#'s estimate of the file size: {itemize} If DataPool# learns from the IFF structure of the data, that its size should be greater than it really is, then any attempt to read non-existing data in the range of {valid} offsets will result in an ByteStream::EndOfFile# exception. This is done to indicate, that there was an error in adding data, and the data requested is { supposed} to be there, but has actually not been added. If DataPool#'s expectations about the data size coincide with the reality then any attempt to read data beyond the legal range of offsets will result in ZERO# bytes returned. {itemize}. {enumerate}.

buffer Buffer to be filled with data
offset Offset in the DataPool# to read data at
size Size of the {buffer}
The number of bytes actually read
STOP The stream has been stopped
EOF The requested data is not there and will not be added, although it should have been.

Definition at line 1102 of file DataPool.cpp.

   return get_data(buffer, offset, sz, 0);

Generated by  Doxygen 1.6.0   Back to index