read_upto


Description:

[ Version ( since = "2.26" ) ]
public string read_upto (string stop_chars, ssize_t stop_chars_len, out size_t length, Cancellable? cancellable = null) throws IOError

Reads a string from the data input stream, up to the first occurrence of any of the stop characters.

In contrast to read_until, this function does not consume the stop character. You have to use read_byte to get it before calling read_upto again.

Note that stop_chars may contain '\0' if stop_chars_len is specified.

The returned string will always be nul-terminated on success.

Parameters:

this

a DataInputStream

stop_chars

characters to terminate the read

stop_chars_len

length of stop_chars. May be -1 if stop_chars is nul-terminated

length

a size_t to get the length of the data read in

cancellable

optional Cancellable object, null to ignore

Returns:

a string with the data that was read before encountering any of the stop characters. Set length to a size_t to get the length of the string. This function will return null on an error