|
@@ -185,7 +185,7 @@ public:
|
|
|
|
|
|
Optional<size_t> offset_of(ReadonlyBytes value) const
|
|
|
{
|
|
|
- if (value.size() > remaining())
|
|
|
+ if (value.size() > size())
|
|
|
return {};
|
|
|
|
|
|
// First, find which chunk we're in.
|
|
@@ -288,7 +288,7 @@ public:
|
|
|
|
|
|
ByteBuffer copy_into_contiguous_buffer() const
|
|
|
{
|
|
|
- auto buffer = ByteBuffer::create_uninitialized(remaining());
|
|
|
+ auto buffer = ByteBuffer::create_uninitialized(size());
|
|
|
|
|
|
const auto nread = read_without_consuming(buffer);
|
|
|
ASSERT(nread == buffer.size());
|
|
@@ -299,7 +299,7 @@ public:
|
|
|
size_t roffset() const { return m_read_offset; }
|
|
|
size_t woffset() const { return m_write_offset; }
|
|
|
|
|
|
- size_t remaining() const { return m_write_offset - m_read_offset; }
|
|
|
+ size_t size() const { return m_write_offset - m_read_offset; }
|
|
|
|
|
|
private:
|
|
|
void try_discard_chunks()
|
|
@@ -316,24 +316,8 @@ private:
|
|
|
size_t m_base_offset { 0 };
|
|
|
};
|
|
|
|
|
|
-class OutputMemoryStream final : public OutputStream {
|
|
|
-public:
|
|
|
- size_t write(ReadonlyBytes bytes) override { return m_stream.write(bytes); }
|
|
|
- bool write_or_error(ReadonlyBytes bytes) override { return m_stream.write_or_error(bytes); }
|
|
|
-
|
|
|
- ByteBuffer copy_into_contiguous_buffer() const { return m_stream.copy_into_contiguous_buffer(); }
|
|
|
-
|
|
|
- Optional<size_t> offset_of(ReadonlyBytes value) const { return m_stream.offset_of(value); }
|
|
|
-
|
|
|
- size_t size() const { return m_stream.woffset(); }
|
|
|
-
|
|
|
-private:
|
|
|
- DuplexMemoryStream m_stream;
|
|
|
-};
|
|
|
-
|
|
|
}
|
|
|
|
|
|
using AK::DuplexMemoryStream;
|
|
|
using AK::InputMemoryStream;
|
|
|
using AK::InputStream;
|
|
|
-using AK::OutputMemoryStream;
|