19 #include <aws/io/stream.h>
32 Begin = AWS_SSB_BEGIN,
51 explicit operator bool() const noexcept {
return IsValid(); }
52 virtual bool IsValid() const noexcept = 0;
54 aws_input_stream *GetUnderlyingStream() noexcept {
return &m_underlying_stream; }
56 bool Read(
ByteBuf &dest) {
return aws_input_stream_read(&m_underlying_stream, &dest) == 0; }
59 return aws_input_stream_seek(&m_underlying_stream,
offset, (aws_stream_seek_basis)seekBasis) == 0;
63 return aws_input_stream_get_status(&m_underlying_stream, &status) == 0;
67 return aws_input_stream_get_length(&m_underlying_stream, &
length) == 0;
72 aws_input_stream m_underlying_stream;
95 virtual int64_t GetLengthImpl() const noexcept = 0;
109 static
int s_Seek(aws_input_stream *stream, aws_off_t
offset, enum aws_stream_seek_basis basis);
110 static
int s_Read(aws_input_stream *stream, aws_byte_buf *dest);
111 static
int s_GetStatus(aws_input_stream *stream, aws_stream_status *status);
112 static
int s_GetLength(struct aws_input_stream *stream, int64_t *out_length);
113 static
void s_Destroy(struct aws_input_stream *stream);
115 static aws_input_stream_vtable s_vtable;
125 std::shared_ptr<Aws::Crt::Io::IStream> stream,
128 bool IsValid()
const noexcept
override;
133 int64_t GetLengthImpl()
const noexcept
override;
137 std::shared_ptr<Aws::Crt::Io::IStream> m_stream;