Files
opencloud/vendor/github.com/gookit/goutil/strutil/bytes.go
dependabot[bot] 89a7d171ee build(deps): bump github.com/gookit/config/v2 from 2.2.6 to 2.2.7
Bumps [github.com/gookit/config/v2](https://github.com/gookit/config) from 2.2.6 to 2.2.7.
- [Release notes](https://github.com/gookit/config/releases)
- [Commits](https://github.com/gookit/config/compare/v2.2.6...v2.2.7)

---
updated-dependencies:
- dependency-name: github.com/gookit/config/v2
  dependency-version: 2.2.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-15 14:15:33 +00:00

34 lines
696 B
Go

package strutil
import (
"github.com/gookit/goutil/byteutil"
)
// Buffer wrap and extends the bytes.Buffer
type Buffer = byteutil.Buffer
// NewBuffer instance, can set init size
func NewBuffer(initSize ...int) *Buffer {
if len(initSize) > 0 && initSize[0] > 0 {
buf := &Buffer{}
buf.Grow(initSize[0])
return buf
}
return &Buffer{}
}
// ByteChanPool struct
//
// Usage:
//
// bp := strutil.NewByteChanPool(500, 1024, 1024)
// buf:=bp.Get()
// defer bp.Put(buf)
// // use buf do something ...
type ByteChanPool = byteutil.ChanPool
// NewByteChanPool instance
func NewByteChanPool(maxSize, width, capWidth int) *ByteChanPool {
return byteutil.NewChanPool(maxSize, width, capWidth)
}