43 explicit async_result_stream(
const xtd::any_object& async_state) : async_state_(async_state) {}
44 xtd::any_object async_state()
const noexcept override {
return async_state_;}
46 bool completed_synchronously()
const noexcept override {
return false;}
47 bool is_completed()
const noexcept override {
return is_completed_;};
50 bool is_completed_ =
false;
52 std::exception_ptr exception_;
55 class streambuf :
public std::streambuf {
59 int_type underflow()
override;
60 int_type overflow(int_type value)
override;
65 char_type* value_ptr_ =
reinterpret_cast<char_type*
>(&value_);
91 [[nodiscard]]
virtual auto can_read() const noexcept ->
bool = 0;
95 [[nodiscard]] virtual auto
can_seek() const noexcept ->
bool = 0;
104 [[nodiscard]] virtual auto
can_write() const noexcept ->
bool = 0;
108 [[nodiscard]] virtual auto
is_closed() const noexcept ->
bool;
161 auto
copy_to(std::ostream& destination) ->
void;
172 using std::iostream::
read;
188 [[nodiscard]] virtual auto read_byte() ->
xtd::
int32;
204 virtual auto set_length(
xtd::
size value) ->
void = 0;
206 using std::iostream::write;
207 virtual auto write(
xtd::
span<const
xtd::
byte> buffer) ->
void;
210 virtual auto write_byte(
xtd::
byte value) ->
void;
225 streambuf streambuf_ {*
this};
226 bool closed_ =
false;
Contains xtd::abstract_object class.
Contains xtd::async_callback delegate.
Represent an abstract class.
Definition abstract_object.hpp:27
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents the status of an asynchronous operation.
Definition iasync_result.hpp:25
Provides a generic view of a sequence of bytes. This is an abstract class.
Definition stream.hpp:40
virtual auto write_timeout() const -> xtd::int32
Gets a value, in milliseconds, that determines how long the stream will attempt to write before timin...
virtual auto flush() -> void=0
When overridden in a derived class, clears all buffers for this stream and causes any buffered data t...
virtual auto read_timeout() const -> xtd::int32
Gets a value, in milliseconds, that determines how long the stream will attempt to read before timing...
virtual auto length() const -> xtd::size=0
When overridden in a derived class, gets the length in bytes of the stream.
auto read_exactly(xtd::array< xtd::byte > &buffer) -> void
Reads bytes from the current stream and advances the position within the stream until the buffer is f...
virtual auto can_write() const noexcept -> bool=0
Gets a value indicating whether the current stream supports writing.
virtual auto is_closed() const noexcept -> bool
Indicates if the stream is closed.
static xtd::io::null_stream null_stream
A Stream with no backing store.
Definition stream.hpp:79
auto copy_to(std::ostream &destination) -> void
Reads the bytes from the current memory stream and writes them to another stream.
stream()
Initializes a new instance of the xtd::io::stream class.
virtual auto can_seek() const noexcept -> bool=0
When overridden in a derived class, gets a value indicating whether the current stream supports seeki...
virtual auto can_read() const noexcept -> bool=0
When overridden in a derived class, gets a value indicating whether the current stream supports readi...
virtual auto can_timeout() const noexcept -> bool
Gets a value that determines whether the current stream can time out.
auto read_at_least(xtd::array< xtd::byte > &buffer, xtd::size minimum_bytes, bool throw_on_end_of_stream=true) -> xtd::size
Reads at least a minimum number of bytes from the current stream and advances the position within the...
static constexpr xtd::int32 eof
Represnets an eof value.
Definition stream.hpp:83
virtual auto position() const -> xtd::size=0
When overridden in a derived class, gets the position within the current stream.
virtual auto read(xtd::span< xtd::byte > &buffer) -> xtd::size
When overridden in a derived class, reads a sequence of bytes from the current stream and advances th...
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Represents a non-owning view over a contiguous sequence of objects.
Definition span.hpp:58
Represents a thread synchronization event that, when signaled, must be reset manually....
Definition manual_reset_event.hpp:35
Encapsulates operating system specific objects that wait for exclusive access to shared resources.
Definition wait_handle.hpp:52
Contains core_export_ keyword.
#define core_export_
Define shared library export.
Definition core_export.hpp:13
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
std::uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.hpp:23
Contains xtd::iasync_result interface.
Contains xtd::io::io_exception exception.
Contains xtd::threading::manual_reset_event exception.
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.hpp:17
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::io::seek_origin enum class.
Contains xtd::span class.
Contains xtd::string alias.