Standard library / bytes

bytes.Reader.Len()

Reports remaining unread bytes, not total size or rune count. Expected stdout: '2\n'.

Formal Syntax & Structure

go syntaxgo
func (r *Reader) Len() int

Return Value

int

Reports remaining unread bytes, not total size or rune count.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt")
func main() {  r := bytes.NewReader([]byte("aé"))  r.ReadByte()  fmt.Println(r.Len())}
Go Reference