| Qore Programming Language Reference Manual 2.2.0

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Qore::BufferedStreamReader Class Reference

This class defines a buffered stream reader for input streams. More...

`#include <QC_BufferedStreamReader.dox.h>`

Inheritance diagram for Qore::BufferedStreamReader:
[legend]

## Public Member Functions
| constructor (Qore::InputStream is, *string encoding, int bufsize=DefaultStreamBufferSize)
| Creates the BufferedStreamReader for reading data from the given InputStream.
Public Member Functions inherited from Qore::StreamReader
| constructor (Qore::InputStream is, *string encoding)
| Creates the StreamReader for reading data from the given InputStream.
string | getEncoding ()
| Returns the character encoding for the StreamReader.
InputStream | getInputStream ()
| Returns the InputStream for the StreamReader.
*binary | readBinary (int limit=-1)
| Reads binary data from the input stream up to a given limit.
*string | readLine (*string eol, bool trim=True)
| Reads a text line from the input stream.
*string | readString (int limit=-1)
| Reads a string from the input stream.
int | readi1 ()
| Reads a 1-byte signed integer from the input stream.
int | readi2 ()
| Reads a 2-byte (16 bit) signed integer from the input stream in binary big-endian format.
int | readi2LSB ()
| Reads a 2-byte (16 bit) signed integer from the input stream in binary little-endian format.
int | readi4 ()
| Reads a 4-byte (32 bit) signed integer from the input stream in binary big-endian format.
int | readi4LSB ()
| Reads a 4-byte (32 bit) signed integer from the input stream in binary little-endian format.
int | readi8 ()
| Reads a 8-byte (64 bit) signed integer from the input stream in binary big-endian format.
int | readi8LSB ()
| Reads a 8-byte (64 bit) signed integer from the input stream in binary little-endian format.
int | readu1 ()
| Reads a 1-byte unsigned integer from the input stream.
int | readu2 ()
| Reads a 2-byte (16 bit) unsigned integer from the input stream in binary big-endian format.
int | readu2LSB ()
| Reads a 2-byte (16 bit) unsigned integer from the input stream in binary little-endian format.
int | readu4 ()
| Reads a 4-byte (32 bit) unsigned integer from the input stream in binary big-endian format.
int | readu4LSB ()
| Reads a 4-byte (32 bit) unsigned integer from the input stream in binary little-endian format.

## Detailed Description

This class defines a buffered stream reader for input streams.

Since
  Qore 0.8.13

Example: BufferedStreamReader basic usage
  FileInputStream is("data.txt");
  BufferedStreamReader sr(is, "UTF-8");
  *string line = sr.readLine();
  *binary b = sr.readBinary(256);
  int i = sr.readi4();

See also
  Qore::InputStream

## Member Function Documentation

## ◆ constructor()

Qore::BufferedStreamReader::constructor | ( | Qore::InputStream | is,
|  | *string | encoding,
|  | int | bufsize = DefaultStreamBufferSize )

Creates the BufferedStreamReader for reading data from the given InputStream.

Parameters

  is | the InputStream for reading data
  encoding | the character encoding of the data from the InputStream; if not present, the default character encoding is assumed
  bufsize | the size of the internal buffer in bytes; must be a positive integer

Exceptions

  STREAM-BUFFER-ERROR | an invalid stream buffer size was specified; the buffer size must be a positive integer