Documentation ¶
Overview ¶
Description: Implements a buffered writer that writes the last N bytes written to it
Description: Implements a writer that is limited to a specified number of bytes
Package orio implements IO utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLimitExceeded = errors.New("size limit exceeded")
ErrLimitExceeded is returned if writes exceed the capacity.
Functions ¶
This section is empty.
Types ¶
type BufferedWriter ¶
type BufferedWriter struct { N int // contains filtered or unexported fields }
BufferedWriter buffers the last N bytes written to it.
It does not error if more writes happen but uses a circular buffer and keeps only the last N bytes.
Use Bytes() to access the buffer.
func (*BufferedWriter) Bytes ¶
func (b *BufferedWriter) Bytes() []byte
type Error ¶
type Error struct {
Err error
}
Error is a io.ReadWriteClose implementation that returns the underlying error for everything.
type LimitedWriter ¶
type LimitedWriter struct { N int // contains filtered or unexported fields }
LimitedWriter limits write to a max of specified number of bytes.
It returns ErrLimitExceeded if the write exceeds this limit.
func (*LimitedWriter) Bytes ¶
func (l *LimitedWriter) Bytes() []byte
type ReadCloser ¶
ReadCloser provides a simple way to create an io.ReadCloser by combining io.Reader and io.Closer