Represents a reader that can read a sequential series of characters.
Public Fields | |
| static null_text_reader & | null () noexcept |
| Provides a text_reader with no data to read from. | |
Public Static Methods | |
| static auto | synchronised (text_reader &reader) noexcept -> synchronized_text_reader |
| Creates a thread-safe (synchronized) wrapper around the specified text_reader object. | |
Public Methods | |
| virtual auto | close () -> void |
| Closes the xtd::io::text_reader and releases any system resources associated with the text_reader. | |
| virtual auto | peek () const -> xtd::int32 |
| Reads the next character without changing the state of the reader or the character source. Returns the next available character without actually reading it from the input stream. | |
| virtual auto | read () -> xtd::int32 |
| Reads the next character from the input stream and advances the character position by one character. | |
| virtual auto | read (xtd::span< char > &buffer) -> xtd::usize |
| Reads the characters from the current reader and writes the data to the specified buffer. | |
| virtual auto | read (xtd::array< char > &buffer, xtd::usize index, xtd::usize count) -> xtd::usize |
| Reads a specified maximum number of characters from the current text reader and writes the data to a buffer, beginning at the specified index. | |
| virtual auto | read_block (xtd::span< char > &buffer) -> xtd::usize |
| Reads the characters from the current stream and writes the data to a buffer. | |
| virtual auto | read_block (xtd::array< char > &buffer, xtd::usize index, xtd::usize count) -> xtd::usize |
| Reads a specified maximum number of characters from the current text reader and writes the data to a buffer, beginning at the specified index. | |
| virtual auto | read_line () -> xtd::string |
| Reads a line of characters from the current stream and returns the data as a string. | |
| virtual auto | read_to_end () -> xtd::string |
| Reads all characters from the current position to the end of the text_reader and returns them as one string. | |
Protected constructors | |
| text_reader ()=default | |
| Initializes a new instance of the xtd::io::text_reader class. | |
Additional Inherited Members | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual auto | equals (const object &obj) const noexcept -> bool |
| Determines whether the specified object is equal to the current object. | |
| virtual auto | get_hash_code () const noexcept -> xtd::usize |
| Serves as a hash function for a particular type. | |
| virtual auto | get_type () const noexcept -> type_object |
| Gets the type of the current instance. | |
| template<typename object_t> | |
| auto | memberwise_clone () const -> xtd::unique_ptr_object< object_t > |
| Creates a shallow copy of the current object. | |
| virtual auto | to_string () const -> xtd::string |
| Returns a xtd::string that represents the current object. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are considered equal. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are the same instance. | |
|
protecteddefault |
Initializes a new instance of the xtd::io::text_reader class.
|
staticnoexcept |
Provides a text_reader with no data to read from.
|
virtual |
Closes the xtd::io::text_reader and releases any system resources associated with the text_reader.
Reimplemented in xtd::io::stream_reader.
|
nodiscardvirtual |
Reads the next character without changing the state of the reader or the character source. Returns the next available character without actually reading it from the input stream.
Reimplemented in xtd::io::stream_reader, and xtd::io::string_reader.
|
nodiscardvirtual |
Reads the next character from the input stream and advances the character position by one character.
Reimplemented in xtd::io::null_text_reader, xtd::io::stream_reader, xtd::io::string_reader, and xtd::io::synchronized_text_reader.
|
virtual |
Reads the characters from the current reader and writes the data to the specified buffer.
| buffer | When this method returns, contains the specified span of characters replaced by the characters read from the current source. |
|
virtual |
Reads a specified maximum number of characters from the current text reader and writes the data to a buffer, beginning at the specified index.
| buffer | When this method returns, this parameter contains the specified character array with the values between index and (index + count -1) replaced by the characters read from the current source. |
| index | The position in buffer at which to begin writing. |
| count | The maximum number of characters to read. |
|
virtual |
Reads the characters from the current stream and writes the data to a buffer.
| buffer | When this method returns, contains the specified span of characters replaced by the characters read from the current source. |
|
virtual |
Reads a specified maximum number of characters from the current text reader and writes the data to a buffer, beginning at the specified index.
| buffer | When this method returns, this parameter contains the specified character array with the values between index and (index + count -1) replaced by the characters read from the current source. |
| index | The position in buffer at which to begin writing. |
| count | The maximum number of characters to read. |
|
nodiscardvirtual |
Reads a line of characters from the current stream and returns the data as a string.
|
nodiscardvirtual |
Reads all characters from the current position to the end of the text_reader and returns them as one string.
| io::io_exception | An I/O error occurs. |
|
staticnodiscardnoexcept |
Creates a thread-safe (synchronized) wrapper around the specified text_reader object.
| reader | The text_reader object to synchronize. |