micro/util/buf/buf.go

22 lines
241 B
Go
Raw Normal View History

package buf
2015-01-14 02:31:27 +03:00
import (
"bytes"
2015-01-14 02:31:27 +03:00
)
type buffer struct {
*bytes.Buffer
2015-01-14 02:31:27 +03:00
}
func (b *buffer) Close() error {
b.Buffer.Reset()
2015-01-14 02:31:27 +03:00
return nil
}
func New(b *bytes.Buffer) *buffer {
if b == nil {
b = bytes.NewBuffer(nil)
}
return &buffer{b}
}