Standard library / bufio
bufio.NewReaderSize()
Creates a buffered reader with at least the requested capacity, possibly reusing a sufficiently large existing Reader. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func NewReaderSize(rd io.Reader, size int) *ReaderParameters & Attributes
| Name | Type | Description |
|---|---|---|
| rd | io.Reader | Underlying source reader. |
| size | int | Requested buffer capacity. |
Return Value
*Reader
Creates a buffered reader with at least the requested capacity, possibly reusing a sufficiently large existing Reader.
Working Example
Example Snippetgo
package main
import ( "bufio" "fmt" "strings")
func main() { r := bufio.NewReaderSize(strings.NewReader("abc"), 32); fmt.Println(r.Size() >= 32) }