Closed wbpcode closed 3 years ago
Envoy integrating Hessian2-codec requires you to implement your own custom readers and writers to match the Buffer interface inside the Envoy.
class BufferReader : public hessian2::Reader {
public:
BufferReader(Buffer::Instance& buffer) : buffer_(buffer) {}
virtual ~BufferReader() override = default;
virtual void RawReadNbytes(void* out, size_t len, size_t peek_offset) override {
ASSERT(ByteAvailable() + peek_offset >= len);
buffer_.copyOut(Offset() + peek_offset, len, out);
}
virtual uint64_t Length() const override { return buffer_.length(); }
private:
const Buffer::Instance& buffer_;
};
@wbpcode
@zyfjeff Yes, you are right. It's protected
not private
.
I will close this pr.
I'm not sure I have the right idea. But I think there does need to be a way to set the initial offset of the reader. This would allow us to skip parsing some content if necessary.
Signed-off-by: wbpcode comems@msn.com