chunkedreader

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorFileClosed  = errors.New("file already closed")
	ErrorInvalidSeek = errors.New("invalid seek position")
)

io related errors returned by ChunkedReader

Functions

This section is empty.

Types

type ChunkedReader

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

ChunkedReader is a reader for a Object with the possibility of reading the source in chunks of given size

A initialChunkSize of <= 0 will disable chunked reading.

func New

func New(o fs.Object, initialChunkSize int64, maxChunkSize int64) *ChunkedReader

New returns a ChunkedReader for the Object.

A initialChunkSize of <= 0 will disable chunked reading. If maxChunkSize is greater than initialChunkSize, the chunk size will be doubled after each chunk read with a maximun of maxChunkSize. A Seek or RangeSeek will reset the chunk size to it's initial value

func (*ChunkedReader) Close

func (cr *ChunkedReader) Close() error

Close the file - for details see io.Closer

All methods on ChunkedReader will return ErrorFileClosed afterwards

func (*ChunkedReader) Open

func (cr *ChunkedReader) Open() (*ChunkedReader, error)

Open forces the connection to be opened

func (*ChunkedReader) RangeSeek

func (cr *ChunkedReader) RangeSeek(offset int64, whence int, length int64) (int64, error)

RangeSeek the file - for details see RangeSeeker

The specified length will only apply to the next chunk opened. RangeSeek will not reopen the source until Read is called.

func (*ChunkedReader) Read

func (cr *ChunkedReader) Read(p []byte) (n int, err error)

Read from the file - for details see io.Reader

func (*ChunkedReader) Seek

func (cr *ChunkedReader) Seek(offset int64, whence int) (int64, error)

Seek the file - for details see io.Seeker

Jump to

Keyboard shortcuts

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