Standard library / io
io.SectionReader.Size()
Returns the configured size of the section, not the unread byte count. Expected stdout: '2\n'.
Formal Syntax & Structure
go syntaxgo
func (s *SectionReader) Size() int64Return Value
int64
Returns the configured size of the section, not the unread byte count.
Working Example
Example Snippetgo
package main
import ( "fmt" "io" "strings")
func main() { s := io.NewSectionReader(strings.NewReader("abcd"), 1, 2) s.Read(make([]byte, 1)) fmt.Println(s.Size())}