#include <BufferedReader.h>
Public Member Functions | |
BufferedReader (Reader *in) | |
virtual void | close () |
virtual void | mark () |
virtual boolean | markSupported () |
virtual int | read () |
virtual int | read (char *cbuf, int length) |
virtual int | read (char *cbuf, int off, int length) |
virtual boolean | ready () |
virtual void | reset () |
virtual long | skip (long length) |
virtual CFREE char * | readLine () |
Protected Member Functions | |
void | en (char *str) |
Private Member Functions | |
int | preRead (char *cbuf, int off, int length) |
int | findLineInBuffer () |
void | fill () |
Private Attributes | |
CDELETE Reader * | in |
char * | cb |
long | nChars |
int | nextChar |
int | maxChars |
long | defaultCharBufferSize |
long | defaultExpectedLineLength |
CDELETE StringBuffer * | sb |
virtual void jcpp::BufferedReader::close | ( | ) | [inline, virtual] |
virtual void jcpp::BufferedReader::mark | ( | ) | [inline, virtual] |
Mark this point in the read stream.
Reimplemented from jcpp::Reader.
00035 { 00036 en((char *)"not allowed to use mark() in Reader"); 00037 }
virtual boolean jcpp::BufferedReader::markSupported | ( | ) | [inline, virtual] |
virtual int jcpp::BufferedReader::read | ( | ) | [virtual] |
Read a single character off the stream.
Implements jcpp::Reader.
virtual int jcpp::BufferedReader::read | ( | char * | cbuf, | |
int | length | |||
) | [inline, virtual] |
Read length bytes into the buffer pointed to by cbuf.
Reimplemented from jcpp::Reader.
00045 { 00046 return read(cbuf, 0 , length); 00047 }
int jcpp::BufferedReader::preRead | ( | char * | cbuf, | |
int | off, | |||
int | length | |||
) | [private] |
This reads a blob of characters, but does not necessarily fulfill the request. A negative return value means an error has occurred.
virtual int jcpp::BufferedReader::read | ( | char * | cbuf, | |
int | off, | |||
int | length | |||
) | [virtual] |
Read <em length /em> bytes into the buffer pointed to by <em cbuf /em> beginning at the offset <em off /em>.
Implements jcpp::Reader.
virtual boolean jcpp::BufferedReader::ready | ( | ) | [inline, virtual] |
virtual void jcpp::BufferedReader::reset | ( | ) | [inline, virtual] |
Reset the stream back to the previously set mark, if supported, error otherwise.
Reimplemented from jcpp::Reader.
00064 { 00065 en((char *)":-( Reader::reset() not supported"); 00066 }
virtual long jcpp::BufferedReader::skip | ( | long | length | ) | [virtual] |
Skip length bytes or to end-of-file whichever comes first.
Implements jcpp::Reader.
virtual CFREE char* jcpp::BufferedReader::readLine | ( | ) | [virtual] |
Read a line, the terminating newline is replaced with a null.
int jcpp::BufferedReader::findLineInBuffer | ( | ) | [private] |
See if a newline char appears in the current buffer, if so return the index pointing to the newline, otherwise retrun -1.
void jcpp::BufferedReader::fill | ( | ) | [private] |
Fill the buffer; note that this may block.
void jcpp::BufferedReader::en | ( | char * | str | ) | [inline, protected] |