mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
bytes: add example for (*Buffer).Bytes
Change-Id: I49ac604530fff7928fa15de07563418b104da5e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/268260 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Giovanni Bajo <rasky@develer.com>
This commit is contained in:
parent
f2e58c6d42
commit
141fa337ad
1 changed files with 7 additions and 0 deletions
|
|
@ -30,6 +30,13 @@ func ExampleBuffer_reader() {
|
||||||
// Output: Gophers rule!
|
// Output: Gophers rule!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExampleBuffer_Bytes() {
|
||||||
|
buf := bytes.Buffer{}
|
||||||
|
buf.Write([]byte{'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'})
|
||||||
|
os.Stdout.Write(buf.Bytes())
|
||||||
|
// Output: hello world
|
||||||
|
}
|
||||||
|
|
||||||
func ExampleBuffer_Grow() {
|
func ExampleBuffer_Grow() {
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
b.Grow(64)
|
b.Grow(64)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue