Change-Id: I24374accf48d43edf4bf27ea6ba2245ddca558ad
Reviewed-on: https://go-review.googlesource.com/50910
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
// some io.Reader stream to be read
// some io.Reader stream to be read
}
+
+func ExamplePipe() {
+ r, w := io.Pipe()
+
+ go func() {
+ fmt.Fprint(w, "some text to be read\n")
+ w.Close()
+ }()
+
+ buf := new(bytes.Buffer)
+ buf.ReadFrom(r)
+ fmt.Print(buf.String())
+
+ // Output:
+ // some text to be read
+}