Standard library / io
io.SectionReader
Bounded ReaderAt adapter with Read, ReadAt and Seek; offsets are relative to its start. Expected stdout: 'bc\n'.
Formal Syntax & Structure
go syntaxgo
type SectionReader struct { /* unexported fields */ }Working Example
Example Snippetgo
package main
import ( "fmt" "io" "strings")
func main() { var s *io.SectionReader = io.NewSectionReader(strings.NewReader("abcd"), 1, 2) p, _ := io.ReadAll(s) fmt.Println(string(p))}