A Reader implements the [io.Reader], [io.ReaderAt], [io.WriterTo], [io.Seeker],
[io.ByteScanner], and [io.RuneScanner] interfaces by reading from
a byte slice.
Unlike a [Buffer], a Reader is read-only and supports seeking.
The zero value for Reader operates like a Reader of an empty slice.
Len returns the number of bytes of the unread portion of the
slice.
Returns number
read
read(b): number
Read implements the [io.Reader] interface.
Parameters
b: string | number[]
Returns number
readAt
readAt(b, off): number
ReadAt implements the [io.ReaderAt] interface.
Parameters
b: string | number[]
off: number
Returns number
readByte
readByte(): number
ReadByte implements the [io.ByteReader] interface.
Returns number
readRune
readRune(): [number, number]
ReadRune implements the [io.RuneReader] interface.
Returns [number, number]
reset
reset(b): void
Reset resets the [Reader] to be reading from b.
Parameters
b: string | number[]
Returns void
seek
seek(offset, whence): number
Seek implements the [io.Seeker] interface.
Parameters
offset: number
whence: number
Returns number
size
size(): number
Size returns the original length of the underlying byte slice.
Size is the number of bytes available for reading via [Reader.ReadAt].
The result is unaffected by any method calls except [Reader.Reset].
Returns number
unreadByte
unreadByte(): void
UnreadByte complements [Reader.ReadByte] in implementing the [io.ByteScanner] interface.
Returns void
unreadRune
unreadRune(): void
UnreadRune complements [Reader.ReadRune] in implementing the [io.RuneScanner] interface.
A Reader implements the [io.Reader], [io.ReaderAt], [io.WriterTo], [io.Seeker], [io.ByteScanner], and [io.RuneScanner] interfaces by reading from a byte slice. Unlike a [Buffer], a Reader is read-only and supports seeking. The zero value for Reader operates like a Reader of an empty slice.