diff --git a/zbytes/zbytes.go b/zbytes/zbytes.go index 4fdfc1a76bf9d688b0338dbff2d6b187cabb41f3..bca35fdb9574deb68164519a3891cbfa7763ff0e 100644 --- a/zbytes/zbytes.go +++ b/zbytes/zbytes.go @@ -2,6 +2,7 @@ package zbytes import ( "bytes" + "fmt" "sync" ) @@ -41,6 +42,9 @@ func (z *Buffer) WriteString(s string) (n int, err error) { return z.Buff.WriteString(s) } +func (z *Buffer) WriteAny(a any) (n int, err error) { + return z.WriteString(fmt.Sprintf("%v", a)) +} func (z *Buffer) Bytes() []byte { z.Mu.Lock() @@ -48,14 +52,12 @@ func (z *Buffer) Bytes() []byte { return z.Buff.Bytes() } - func (z *Buffer) String() string { z.Mu.Lock() defer z.Mu.Unlock() return z.Buff.String() } - func (z *Buffer) Reset() { z.Mu.Lock() defer z.Mu.Unlock() @@ -68,3 +70,10 @@ func (z *Buffer) Len() int { return z.Buff.Len() } + +func (z *Buffer) Lock() { + z.Mu.Lock() +} +func (z *Buffer) Unlock() { + z.Mu.Unlock() +}