Standard library / bytes

bytes.Reader.Size()

Reports the original input byte length, independent of the cursor. Expected stdout: '3\n'.

Formal Syntax & Structure

go syntaxgo
func (r *Reader) Size() int64

Return Value

int64

Reports the original input byte length, independent of the cursor.

Working Example

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