github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/log/slog/internal/buffer/buffer.go (about) 1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package buffer provides a pool-allocated byte buffer. 6 package buffer 7 8 // buffer adapted from go/src/fmt/print.go 9 type Buffer []byte 10 11 func New() *Buffer 12 13 func (b *Buffer) Free() 14 15 func (b *Buffer) Reset() 16 17 func (b *Buffer) Write(p []byte) (int, error) 18 19 func (b *Buffer) WriteString(s string) (int, error) 20 21 func (b *Buffer) WriteByte(c byte) error 22 23 func (b *Buffer) String() string 24 25 func (b *Buffer) Len() int 26 27 func (b *Buffer) SetLen(n int)