mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:57:46 +00:00
LibCore: Add a basic wrapper for adapting AK::Stream to Core::Stream
This commit is contained in:
parent
6daef6303a
commit
7a065513cd
2 changed files with 96 additions and 0 deletions
|
@ -968,4 +968,32 @@ private:
|
|||
using ReusableTCPSocket = BasicReusableSocket<TCPSocket>;
|
||||
using ReusableUDPSocket = BasicReusableSocket<UDPSocket>;
|
||||
|
||||
// Note: This is only a temporary hack, to break up the task of moving away from AK::Stream into smaller parts.
|
||||
class WrappedAKInputStream final : public Stream {
|
||||
public:
|
||||
WrappedAKInputStream(NonnullOwnPtr<InputStream> stream);
|
||||
virtual ErrorOr<Bytes> read(Bytes) override;
|
||||
virtual ErrorOr<size_t> write(ReadonlyBytes) override;
|
||||
virtual bool is_eof() const override;
|
||||
virtual bool is_open() const override;
|
||||
virtual void close() override;
|
||||
|
||||
private:
|
||||
NonnullOwnPtr<InputStream> m_stream;
|
||||
};
|
||||
|
||||
// Note: This is only a temporary hack, to break up the task of moving away from AK::Stream into smaller parts.
|
||||
class WrappedAKOutputStream final : public Stream {
|
||||
public:
|
||||
WrappedAKOutputStream(NonnullOwnPtr<OutputStream> stream);
|
||||
virtual ErrorOr<Bytes> read(Bytes) override;
|
||||
virtual ErrorOr<size_t> write(ReadonlyBytes) override;
|
||||
virtual bool is_eof() const override;
|
||||
virtual bool is_open() const override;
|
||||
virtual void close() override;
|
||||
|
||||
private:
|
||||
NonnullOwnPtr<OutputStream> m_stream;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue