CLucene - a full-featured, c++ search engine
API Documentation
#include <bufferedstream.h>
Public Member Functions | |
int32_t | read (const T *&start, int32_t min, int32_t max) |
Reads characters from the stream and sets start to the first character that was read. | |
int64_t | reset (int64_t) |
Repositions this stream to given requested position. | |
virtual int64_t | skip (int64_t ntoskip) |
Skip. | |
Protected Member Functions | |
virtual int32_t | fillBuffer (T *start, int32_t space)=0 |
This function must be implemented by the subclasses. | |
void | resetBuffer () |
BufferedInputStream () |
jstreams::BufferedInputStream< T >::BufferedInputStream | ( | ) | [inline, protected] |
virtual int32_t jstreams::BufferedInputStream< T >::fillBuffer | ( | T * | start, | |
int32_t | space | |||
) | [protected, pure virtual] |
This function must be implemented by the subclasses.
It should write a maximum of space
characters at the buffer position pointed to by start
. If no more data is avaiable due to end of file, -1 should be returned. If an error occurs, the status should be set to Error, an error message should be set and the function must return -1.
Implemented in lucene::store::IndexInputStream, and jstreams::FileInputStream.
void jstreams::BufferedInputStream< T >::resetBuffer | ( | ) | [inline, protected] |
int32_t jstreams::BufferedInputStream< T >::read | ( | const T *& | start, | |
int32_t | min, | |||
int32_t | max | |||
) | [inline, virtual] |
Reads characters from the stream and sets start to the first character that was read.
If ntoread
is 0
, then at least one character will be read.
start | Pointer passed by reference that will be set to point to the retrieved array of characters. If the end of the stream is encountered or an error occurs, the value of start is undefined. | |
min | The number of characters to read from the stream. | |
max | The maximum number of characters to read from the stream. |
Implements jstreams::StreamBase< T >.
References jstreams::Eof, jstreams::Error, and jstreams::Ok.
Referenced by jstreams::BufferedInputStream< T >::skip().
int64_t jstreams::BufferedInputStream< T >::reset | ( | int64_t | pos | ) | [inline, virtual] |
Repositions this stream to given requested position.
Reset is guaranteed to work after a successful call to read(), when the new position is in the range of the data returned by read(). This means that pos
must lie between than the position corresponding to the start parameter (x) of the read function and the position corresponding to the last position in the returned buffer (x + nread).
Implements jstreams::StreamBase< T >.
References jstreams::Error, and jstreams::Ok.
int64_t jstreams::BufferedInputStream< T >::skip | ( | int64_t | ntoskip | ) | [inline, virtual] |
Skip.
ntoskip | bytes. Unless an error occurs or the end of file is encountered, this amount of bytes is skipped. This function returns new position in the stream. |
Reimplemented from jstreams::StreamBase< T >.
References jstreams::BufferedInputStream< T >::read().