abstract fun peek(): BufferedSource

Returns a new BufferedSource that can read data from this BufferedSource without consuming it. The returned source becomes invalid once this source is next read or closed.

For example, we can use peek() to lookahead and read the same data multiple times.

val buffer = Buffer()

buffer.readUtf8(3) // returns "abc", buffer contains "defghi"

val peek = buffer.peek()
peek.readUtf8(3) // returns "def", buffer contains "defghi"
peek.readUtf8(3) // returns "ghi", buffer contains "defghi"

buffer.readUtf8(3) // returns "def", buffer contains "ghi"
abstract fun peek(): BufferedSource