mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-12-26 12:05:35 -05:00
reduce memory usage in log
This commit is contained in:
@@ -49,6 +49,11 @@ func (b *Buffer) Append(data []byte) *Buffer {
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *Buffer) AppendString(s string) *Buffer {
|
||||
b.Value = append(b.Value, s...)
|
||||
return b
|
||||
}
|
||||
|
||||
// Prepend prepends bytes in front of the buffer. Caller must ensure total bytes prepended is
|
||||
// no more than 16 bytes.
|
||||
func (b *Buffer) Prepend(data []byte) *Buffer {
|
||||
@@ -131,6 +136,10 @@ func (b *Buffer) FillFrom(reader io.Reader) (int, error) {
|
||||
return nBytes, err
|
||||
}
|
||||
|
||||
func (b *Buffer) String() string {
|
||||
return string(b.Value)
|
||||
}
|
||||
|
||||
// NewSmallBuffer creates a Buffer with 1K bytes of arbitrary content.
|
||||
func NewSmallBuffer() *Buffer {
|
||||
return smallPool.Allocate()
|
||||
|
||||
Reference in New Issue
Block a user