Standard library / bufio

bufio.ReadWriter

Embeds Reader and Writer pointers; nonconflicting methods are promoted. Buffered, Reset and Size are ambiguous on the combined type: select Reader or Writer explicitly. Flush the writer explicitly. Expected stdout: 'true true\n'.

Formal Syntax & Structure

go syntaxgo
type ReadWriter struct {  *Reader  *Writer}

Working Example

Example Snippetgo
package main
import (  "bufio"  "bytes"  "fmt"  "strings")
func main() {  var b bytes.Buffer  rw := bufio.NewReadWriter(bufio.NewReader(strings.NewReader("x")), bufio.NewWriter(&b))  fmt.Println(rw.Reader != nil, rw.Writer != nil)}
Go Reference