CLucene - a full-featured, c++ search engine
API Documentation


jstreams::BufferedInputStream< T > Class Template Reference

#include <bufferedstream.h>

Inheritance diagram for jstreams::BufferedInputStream< T >:

jstreams::StreamBase< T >

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 ()

template<class T>
class jstreams::BufferedInputStream< T >


Constructor & Destructor Documentation

template<class T>
jstreams::BufferedInputStream< T >::BufferedInputStream (  )  [inline, protected]


Member Function Documentation

template<class T>
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.

template<class T>
void jstreams::BufferedInputStream< T >::resetBuffer (  )  [inline, protected]

template<class T>
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.

Parameters:
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.
Returns:
the number of characters that were read. If -1 is returned, the end of the stream has been reached. If -2 is returned, an error has occurred.

Implements jstreams::StreamBase< T >.

References jstreams::Eof, jstreams::Error, and jstreams::Ok.

Referenced by jstreams::BufferedInputStream< T >::skip().

template<class T>
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.

template<class T>
int64_t jstreams::BufferedInputStream< T >::skip ( int64_t  ntoskip  )  [inline, virtual]

Skip.

Parameters:
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().


The documentation for this class was generated from the following file:

clucene.sourceforge.net