Library: Foundation
Package: Streams
Header: Poco/BinaryReader.h
This class reads basic types in binary form into an input stream. It provides an extractor-based interface similar to istream. The reader also supports automatic conversion from big-endian (network byte order) to little-endian and vice-versa. Use a BinaryWriter to create a stream suitable for a BinaryReader.
Member Functions: bad, byteOrder, eof, fail, good, operator >>, read7BitEncoded, readBOM, readRaw, stream
the host's native byte-order
big-endian (network) byte-order
big-endian (network) byte-order
little-endian byte-order
unknown, byte-order will be determined by reading the byte-order mark
BinaryReader(
    std::istream & istr,
    StreamByteOrder byteOrder = NATIVE_BYTE_ORDER
);
Creates the BinaryReader.
~BinaryReader();
Destroys the BinaryReader.
 
 bool bad();
Returns _istr.bad();
 
 StreamByteOrder byteOrder() const;
Returns the byte-order used by the reader, which is either BIG_ENDIAN_BYTE_ORDER or LITTLE_ENDIAN_BYTE_ORDER.
 
 bool eof();
Returns _istr.eof();
 
 bool fail();
Returns _istr.fail();
 
 bool good();
Returns _istr.good();
BinaryReader & operator >> (
    bool & value
);
BinaryReader & operator >> (
    char & value
);
BinaryReader & operator >> (
    unsigned char & value
);
BinaryReader & operator >> (
    signed char & value
);
BinaryReader & operator >> (
    short & value
);
BinaryReader & operator >> (
    unsigned short & value
);
BinaryReader & operator >> (
    int & value
);
BinaryReader & operator >> (
    unsigned int & value
);
BinaryReader & operator >> (
    long & value
);
BinaryReader & operator >> (
    unsigned long & value
);
BinaryReader & operator >> (
    float & value
);
BinaryReader & operator >> (
    double & value
);
BinaryReader & operator >> (
    Int64 & value
);
BinaryReader & operator >> (
    UInt64 & value
);
BinaryReader & operator >> (
    std::string & value
);
void read7BitEncoded(
    UInt32 & value
);
Reads a 32-bit unsigned integer in compressed format. See BinaryWriter::write7BitEncoded() for a description of the compression algorithm.
void read7BitEncoded(
    UInt64 & value
);
Reads a 64-bit unsigned integer in compressed format. See BinaryWriter::write7BitEncoded() for a description of the compression algorithm.
void readBOM();
Reads a byte-order mark from the stream and configures the reader for the encountered byte order. A byte-order mark is a 16-bit integer with a value of 0xFEFF, written in host byte order.
void readRaw(
    std::streamsize length,
    std::string & value
);
Reads length bytes of raw data into value.
void readRaw(
    char * buffer,
    std::streamsize length
);
Reads length bytes of raw data into buffer.
 
 std::istream & stream() const;
Returns the underlying stream.