micro/util/buf/buf.go

24 lines
330 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
}
// Close reset buffer contents
func (b *Buffer) Close() error {
b.Buffer.Reset()
2015-01-14 02:31:27 +03:00
return nil
}
// New creates new buffer that satisfies Closer interface
func New(b *bytes.Buffer) *Buffer {
if b == nil {
b = bytes.NewBuffer(nil)
}
return &Buffer{b}
}