seekbuf

package
v0.0.0-...-5a07a87 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

file as a buffer

Index

Constants

View Source
const (
	// FileMode cache reader's data to file
	FileMode = Mode(0)
	// MemoryMode cache reader's data to memory
	MemoryMode = Mode(1)
)

Variables

View Source
var (
	// ErrModeNotFound mode not found
	ErrModeNotFound = errors.New("mode not found")
)

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

Buffer type

func Open

func Open(r io.Reader, m Mode) (*Buffer, error)

Open buffer and use reader as data source

func (*Buffer) Close

func (b *Buffer) Close() error

Close and release

func (*Buffer) Read

func (b *Buffer) Read(p []byte) (n int, err error)

func (*Buffer) ReadAt

func (s *Buffer) ReadAt(p []byte, off int64) (n int, err error)

func (*Buffer) Seek

func (b *Buffer) Seek(offset int64, whence int) (int64, error)

Seek sets the offset for the next Read or Write on the buffer to offset, interpreted according to whence: 0 means relative to the origin of the buffer, 1 means relative to the current offset, and 2 means relative to the end. It returns the new offset and an error, if any.

func (*Buffer) Size

func (b *Buffer) Size() int64

return current buffer len

type Mode

type Mode int

Mode cache mode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL