Documentation
¶
Overview ¶
Package textbuffer provides (as a first rough prototype) handling of cached byte buffers.
Clients create a *TextBuffer, which caches portions of bytes of an io.ReaderAt. The text buffer implements io.ReaderAt itself, thus may be used in the same fashion as the underlying reader.
reader := strings.NewReader("The quick brown fox jumps over the lazy dog.") cache := textbuffer.NewCache(reader, 3) bytebuf := make([]byte, 10) n, err := cache.ReadAt(bytebuf, 4) // reads "quick..."
Index ¶
Constants ¶
View Source
const BufferSize = 10
View Source
const DefaultCacheBufferCount = 3
View Source
const RecycleTimeout = 2 * time.Second
const RecycleTimeout = time.Minute
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TextBuffer ¶
type TextBuffer struct {
// contains filtered or unexported fields
}
func NewBuffer ¶
func NewBuffer() *TextBuffer
Create a text buffer. Will use DefaultBufferSize, if buffersize is 0.
func (*TextBuffer) String ¶
func (tbuf *TextBuffer) String() string
Click to show internal directories.
Click to hide internal directories.