diff options
author | Andrew Kaster <akaster@serenityos.org> | 2023-02-19 18:34:29 -0700 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-21 10:57:44 +0100 |
commit | 0ea697ace57fbc1de834402077d6f0bde1b82f43 (patch) | |
tree | a9c57033c72076a1dede71c288cf0adc859d3462 /AK/String.h | |
parent | 7ac7a73758f7060bc19b48b973a496bd8486dbae (diff) | |
download | serenity-0ea697ace57fbc1de834402077d6f0bde1b82f43.zip |
AK: Add String::from_stream method
The caller is responsible for determining how long the string is that
they want to read.
Diffstat (limited to 'AK/String.h')
-rw-r--r-- | AK/String.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/AK/String.h b/AK/String.h index 187f84458e..f9d6ec48a6 100644 --- a/AK/String.h +++ b/AK/String.h @@ -64,6 +64,9 @@ public: // Creates a new String from a sequence of UTF-8 encoded code points. static ErrorOr<String> from_utf8(StringView); + // Creates a new String by reading byte_count bytes from a UTF-8 encoded Stream. + static ErrorOr<String> from_stream(Stream&, size_t byte_count); + // Creates a new String from a short sequence of UTF-8 encoded code points. If the provided string // does not fit in the short string storage, a compilation error will be emitted. static AK_SHORT_STRING_CONSTEVAL String from_utf8_short_string(StringView string) |