Documentation ¶
Index ¶
- func Append(buf []byte, elems ...byte) []byte
- func AppendString(buf []byte, elems string) []byte
- func Get(size int) []byte
- func Make(size int) []byte
- func New(size int) []byte
- func NewBytes(bs []byte) []byte
- func NewString(s string) []byte
- func Put(buf []byte)
- func Release(buf []byte) bool
- func SetMaxSize(size int) bool
- type CapacityPools
- func (p *CapacityPools) Append(buf []byte, elems ...byte) []byte
- func (p *CapacityPools) AppendString(buf []byte, elems string) []byte
- func (p *CapacityPools) Get(size int) []byte
- func (p *CapacityPools) Make(capacity int) []byte
- func (p *CapacityPools) New(size int) (buf []byte)
- func (p *CapacityPools) NewBytes(bs []byte) []byte
- func (p *CapacityPools) NewString(s string) []byte
- func (p *CapacityPools) Put(buf []byte)
- func (p *CapacityPools) Release(buf []byte) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendString ¶
Types ¶
type CapacityPools ¶
type CapacityPools struct {
// contains filtered or unexported fields
}
func (*CapacityPools) Append ¶
func (p *CapacityPools) Append(buf []byte, elems ...byte) []byte
Append 与内置的 append 功能相同, 当底层数组需要重建时, 会回收原数组
func (*CapacityPools) AppendString ¶
func (p *CapacityPools) AppendString(buf []byte, elems string) []byte
func (*CapacityPools) Make ¶
func (p *CapacityPools) Make(capacity int) []byte
Make 返回 len 为 0, cap >= 给定值的 []byte
func (*CapacityPools) New ¶
func (p *CapacityPools) New(size int) (buf []byte)
New 返回指定长度的 []byte 注:
- 返回的 buf != nil
- 由于复用底层数组, buf 可能残留有旧数据
func (*CapacityPools) NewBytes ¶ added in v0.9.2
func (p *CapacityPools) NewBytes(bs []byte) []byte
NewBytes returns a byte slice of the specified content.
func (*CapacityPools) NewString ¶ added in v0.9.2
func (p *CapacityPools) NewString(s string) []byte
NewString returns a byte slice of the specified content.
func (*CapacityPools) Release ¶
func (p *CapacityPools) Release(buf []byte) bool
Click to show internal directories.
Click to hide internal directories.