Represents a reader that can read a sequential series of characters.
Represents a reader that can read a sequential series of characters.
Definition text_reader.h:36
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
#define core_export_
Define shared library export.
Definition core_export.h:13
- Inheritance
- xtd::object → xtd::io::text_reader
- Header
#include <xtd/io/text_reader>
- Namespace
- xtd::io
- Library
- xtd.core
|
virtual void | close () |
| Closes the xtd::io::text_reader and releases any system resources associated with the text_reader.
|
|
virtual int32 | peek () const |
| 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 int32 | read () |
| Reads the next character from the input stream and advances the character position by one character.
|
|
virtual size_t | read (std::vector< char > &buffer, size_t index, size_t count) |
| 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 size_t | read_block (std::vector< char > &buffer, size_t index, size_t count) |
| 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 xtd::string | read_line () |
| Reads a line of characters from the current stream and returns the data as a string.
|
|
virtual xtd::string | read_to_end () |
| Reads all characters from the current position to the end of the text_reader and returns them as one string.
|
|
|
| object ()=default |
| Create a new instance of the ultimate base class object.
|
|
virtual bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object.
|
|
virtual size_t | get_hash_code () const noexcept |
| Serves as a hash function for a particular type.
|
|
virtual type_object | get_type () const noexcept |
| Gets the type of the current instance.
|
|
template<typename object_t > |
xtd::uptr< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object.
|
|
virtual xtd::string | to_string () const noexcept |
| Returns a xtd::string that represents the current object.
|
|
template<typename object_a_t , typename object_b_t > |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal.
|
|
template<typename object_a_t , typename object_b_t > |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance.
|
|
◆ text_reader()
xtd::io::text_reader::text_reader |
( |
| ) |
|
|
protecteddefault |
◆ null()
◆ close()
virtual void xtd::io::text_reader::close |
( |
| ) |
|
|
virtual |
◆ peek()
virtual int32 xtd::io::text_reader::peek |
( |
| ) |
const |
|
virtual |
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.
- Returns
- An integer representing the next character to be read, or EOF if no more characters are available or the stream does not support seeking.
Reimplemented in xtd::io::stream_reader, and xtd::io::string_reader.
◆ read() [1/2]
virtual int32 xtd::io::text_reader::read |
( |
| ) |
|
|
virtual |
◆ read() [2/2]
virtual size_t xtd::io::text_reader::read |
( |
std::vector< char > & |
buffer, |
|
|
size_t |
index, |
|
|
size_t |
count |
|
) |
| |
|
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.
- Parameters
-
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. |
- Returns
- The number of characters that have been read. The number will be less than or equal to count, depending on whether all input characters have been read.
◆ read_block()
virtual size_t xtd::io::text_reader::read_block |
( |
std::vector< char > & |
buffer, |
|
|
size_t |
index, |
|
|
size_t |
count |
|
) |
| |
|
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.
- Parameters
-
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. |
- Returns
- The number of characters that have been read. The number will be less than or equal to count, depending on whether all input characters have been read.
◆ read_line()
virtual xtd::string xtd::io::text_reader::read_line |
( |
| ) |
|
|
virtual |
◆ read_to_end()
virtual xtd::string xtd::io::text_reader::read_to_end |
( |
| ) |
|
|
virtual |
Reads all characters from the current position to the end of the text_reader and returns them as one string.
- Returns
- A string containing all characters from the current position to the end of the text_reader.
- Exceptions
-
◆ synchronised()
The documentation for this class was generated from the following file: