Qore Programming Language  1.7.0
StreamReader Class Reference

Private data for the Qore::StreamReader class. More...

#include <StreamReader.h>

Inheritance diagram for StreamReader:
Collaboration diagram for StreamReader:

Public Member Methods

int64 peekCheck (ExceptionSink *xsink)
 Peeks the next byte from the input stream. More...
 
virtual DLLLOCAL qore_offset_t read (ExceptionSink *xsink, void *dest, size_t limit, bool require_all=true)
 Read data until a limit. More...
 
DLLLOCAL BinaryNodereadBinary (int64 limit, ExceptionSink *xsink)
 Read binary data from the stream. More...
 
DLLLOCAL QoreStringNodereadLine (const QoreStringNode *eol, bool trim, ExceptionSink *xsink)
 Read one line. More...
 
DLLLOCAL QoreStringNodereadString (int64 size, ExceptionSink *xsink)
 Read string data from the stream. More...
 
- Public Member Methods inherited from AbstractPrivateData
virtual DLLLOCAL void deref ()
 decrements the reference count of the object without the possibility of throwing a Qore-language exception
 
virtual DLLLOCAL void deref (ExceptionSink *xsink)
 decrements the reference count of the object More...
 
DLLLOCAL void ref () const
 increments the reference count of the object
 
- Public Member Methods inherited from QoreReferenceCounter
DLLEXPORT QoreReferenceCounter ()
 creates the reference counter object
 
DLLEXPORT QoreReferenceCounter (const QoreReferenceCounter &old)
 creates a new object with a reference count of 1 More...
 
DLLEXPORT ~QoreReferenceCounter ()
 destroys the reference counter object
 
DLLEXPORT bool is_unique () const
 returns true if the reference count is 1 More...
 
DLLEXPORT int reference_count () const
 gets the reference count More...
 
DLLEXPORT bool ROdereference () const
 atomically decrements the reference count More...
 
DLLEXPORT void ROreference () const
 atomically increments the reference count
 

Private Attributes

const QoreEncodingenc
 Encoding of the source input stream.
 
ReferenceHolder< InputStreamin
 Source input stream.
 

Additional Inherited Members

- Private Member Methods inherited from AbstractPrivateData
virtual DLLLOCAL ~AbstractPrivateData ()
 as these objects are reference counted, the destructor should be called only when the reference count = 0 and not manually
 

Detailed Description

Private data for the Qore::StreamReader class.

Member Function Documentation

◆ peekCheck()

int64 StreamReader::peekCheck ( ExceptionSink xsink)
inline

Peeks the next byte from the input stream.

Parameters
xsinkthe exception sink
Returns
the next byte available to be read, -1 indicates an error (end of stream is treated as an error)

References ExceptionSink::raiseException().

◆ read()

virtual DLLLOCAL qore_offset_t StreamReader::read ( ExceptionSink xsink,
void *  dest,
size_t  limit,
bool  require_all = true 
)
inlinevirtual

Read data until a limit.

Parameters
xsinkexception sink
destdestination buffer
limitmaximum amount of data to read
require_allif true then throw an exception if the required amount of data cannot be read from the stream
Returns
amount of data read, -1 in case of error
Since
Qore 0.9

◆ readBinary()

DLLLOCAL BinaryNode* StreamReader::readBinary ( int64  limit,
ExceptionSink xsink 
)
inline

Read binary data from the stream.

Parameters
limitmax amount of data to read; if equal to -1, all data will be read, if equal to 0, no data will be read
xsinkexception sink
Returns
Qore binary read from the stream

◆ readLine()

DLLLOCAL QoreStringNode* StreamReader::readLine ( const QoreStringNode eol,
bool  trim,
ExceptionSink xsink 
)
inline

Read one line.

Parameters
eolend-of-line symbol, if missing and the character encoding is ASCII-compatible, then "\n", "\r", or "\r\n" are supported), otherwise if missing, and the character encoding is not ASCII-compatible, then "\n" is assumed
trimwhether to trim the EOL symbols
xsinkexception sink
Returns
Qore string read from the stream

◆ readString()

DLLLOCAL QoreStringNode* StreamReader::readString ( int64  size,
ExceptionSink xsink 
)
inline

Read string data from the stream.

Parameters
sizemax amount of data to read as a number of characters; if equal to -1, all data will be read, if equal to 0, no data will be read
xsinkexception sink
Returns
Qore string read from the stream

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