一.BinaryReader.h的定义如下:
#ifndef LINYANWENBINARYREADER_H_
#define LINYANWENBINARYREADER_H_
#include "Poco/TextConverter.h"
#include "Poco/Foundation.h"
#include <vector>
#include <istream>
namespace Linyanwen {
class TextEncoding;
class BinaryReader
/// This class reads basic types (and std::vectors thereof)
/// 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.
{
public:
enum StreamByteOrder
{
NATIVE_BYTE_ORDER = 1, /// the host's native byte-order
BIG_ENDIAN_BYTE_ORDER = 2, /// big-endian (network) byte-order
NETWORK_BYTE_ORDER = 2, /// big-endian (network) byte-order
LITTLE_ENDIAN_BYTE_ORDER = 3, /// little-endian byte-order
UNSPECIFIED_BYTE_ORDER = 4 /// unknown, byte-order will be determined by reading the byte-order mark
};
BinaryReader(Poco::UInt8* _buffer,Poco::UInt32 _size);
~BinaryReader();
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 >> (std::string& value);
/****************************************/
void read7BitEncoded(Poco::UInt32&a