sources/network/bytestream.h

changeset 158
de7574d292ad
parent 157
42bb29924218
child 180
2e7225dbd9b2
equal deleted inserted replaced
157:42bb29924218 158:de7574d292ad
55 }; 55 };
56 56
57 class Bytestream 57 class Bytestream
58 { 58 {
59 public: 59 public:
60 Bytestream(Vector<unsigned char>& data); 60 Bytestream(ByteArray& data);
61 61
62 int bytesLeft() const; 62 int bytesLeft() const;
63 Vector<unsigned char>::Iterator getCurrentIterator(); 63 ByteArray::Iterator getCurrentIterator();
64 int position() const; 64 int position() const;
65 Vector<unsigned char> readBuffer(int length); 65 ByteArray readBuffer(int length);
66 int8_t readByte(); 66 int8_t readByte();
67 int32_t readLong(); 67 int32_t readLong();
68 int16_t readShort(); 68 int16_t readShort();
69 String readString(); 69 String readString();
70 float readFloat(); 70 float readFloat();
71 void rewind(); 71 void rewind();
72 void seek(int position); 72 void seek(int position);
73 void write(const unsigned char* val, unsigned int length); 73 void write(const unsigned char* val, unsigned int length);
74 void writeBuffer(const Vector<unsigned char>& other); 74 void writeBuffer(const ByteArray& other);
75 void writeByte(int8_t value); 75 void writeByte(int8_t value);
76 void writeDouble(double val); 76 void writeDouble(double val);
77 void writeFloat(float value); 77 void writeFloat(float value);
78 void writeLong(int32_t value); 78 void writeLong(int32_t value);
79 void writeShort(int16_t value); 79 void writeShort(int16_t value);
80 void writeString(const String& string); 80 void writeString(const String& string);
81 81
82 private: 82 private:
83 Vector<unsigned char>& m_data; 83 ByteArray& m_data;
84 int m_position; 84 int m_position;
85 85
86 int8_t read(); 86 int8_t read();
87 void ensureReadSpace(int bytes); 87 void ensureReadSpace(int bytes);
88 }; 88 };

mercurial