Gio.DataInputStream.prototype.read_upto

function read_upto(stop_chars: String, stop_chars_len: Number(gssize), cancellable: Gio.Cancellable): [return_value: String, length: Number(gsize)] {
    // Gjs wrapper for g_data_input_stream_read_upto()
}
  

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

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

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

Since 2.26

stop_chars

characters to terminate the read

stop_chars_len

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

cancellable

optional Gio.Cancellable object, null to ignore

return_value

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

length

a #gsize to get the length of the data read in