{"modulePath":"github.com/onexstack/onexmesh","version":"v0.0.6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package bytebufferpool\n\nPackage bytebufferpool provides a self-calibrating pool of byte buffers, bucketed by capacity, that reduces GC pressure on byte-heavy hot paths such as codec marshaling and broker payload encoding.\n\n## Functions\n\n```go\nfunc Put(b *ByteBuffer)\n```\nPut returns a byte buffer to the default pool.\n\n## Types\n\n```go\ntype ByteBuffer struct {\n\tB []byte\n}\n```\nByteBuffer is a pooled byte buffer for append-like workloads. Obtain one with Get and return it with Put; its B must not be touched after Put.\n\n```go\nfunc Get() *ByteBuffer\n```\nGet returns an empty byte buffer from the default pool.\n\n```go\nfunc (b *ByteBuffer) Bytes() []byte\n```\nBytes returns the accumulated bytes (bytes.Buffer compatibility).\n\n```go\nfunc (b *ByteBuffer) Cap() int\n```\nCap returns the capacity of the buffer.\n\n```go\nfunc (b *ByteBuffer) Len() int\n```\nLen returns the number of bytes in the buffer.\n\n```go\nfunc (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error)\n```\nReadFrom implements io.ReaderFrom, appending all data read from r.\n\n```go\nfunc (b *ByteBuffer) Reset()\n```\nReset empties the buffer without releasing capacity.\n\n```go\nfunc (b *ByteBuffer) Set(p []byte)\n```\nSet replaces the buffer contents with p.\n\n```go\nfunc (b *ByteBuffer) SetString(s string)\n```\nSetString replaces the buffer contents with s.\n\n```go\nfunc (b *ByteBuffer) String() string\n```\nString returns the buffer contents as a string.\n\n```go\nfunc (b *ByteBuffer) Write(p []byte) (int, error)\n```\nWrite implements io.Writer, appending p.\n\n```go\nfunc (b *ByteBuffer) WriteByte(c byte) error\n```\nWriteByte appends a single byte.\n\n```go\nfunc (b *ByteBuffer) WriteString(s string) (int, error)\n```\nWriteString appends s.\n\n```go\nfunc (b *ByteBuffer) WriteTo(w io.Writer) (int64, error)\n```\nWriteTo implements io.WriterTo.\n\n```go\ntype Pool struct {\n\t// contains filtered or unexported fields\n}\n```\nPool is a byte-buffer pool. Distinct pools may be used for distinct buffer types to reduce memory waste.\n\n```go\nfunc (p *Pool) Get() *ByteBuffer\n```\nGet returns a zero-length byte buffer. Return it with Put to reuse its underlying array and minimize GC overhead.\n\n```go\nfunc (p *Pool) Put(b *ByteBuffer)\n```\nPut returns a byte buffer obtained via Get to the pool. b.B must not be touched after this call.\n\n","path":"github.com/onexstack/onexmesh/pkg/core/bytebufferpool","name":"bytebufferpool","synopsis":"Package bytebufferpool provides a self-calibrating pool of byte buffers, bucketed by capacity, that reduces GC pressure on byte-heavy hot paths such as codec marshaling and broker payload encoding.","isRedistributable":true}
