iowrap

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackifyReadCloser added in v0.7.0

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

CallbackifyReadCloser will execute callback func in Read.

func CallbackReadCloser added in v0.7.0

func CallbackReadCloser(r io.ReadCloser, fn func([]byte)) *CallbackifyReadCloser

CallbackReadCloser will create a new CallbackifyReadCloser.

func (*CallbackifyReadCloser) Close added in v0.7.0

func (r *CallbackifyReadCloser) Close() error

Close will close underlying Reader.

func (*CallbackifyReadCloser) Read added in v0.7.0

func (r *CallbackifyReadCloser) Read(p []byte) (int, error)

Read will read from underlying Reader.

type CallbackifyReader added in v0.7.0

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

CallbackifyReader will execute callback func in Read.

func CallbackReader added in v0.7.0

func CallbackReader(r io.Reader, fn func([]byte)) *CallbackifyReader

CallbackReader will create a new CallbackifyReader.

func (*CallbackifyReader) Read added in v0.7.0

func (r *CallbackifyReader) Read(p []byte) (int, error)

Read will read from underlying Reader.

type LimitedReadCloser

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

LimitedReadCloser hasCall from underlying r and provide Close as well.

func LimitReadCloser

func LimitReadCloser(r io.ReadCloser, n int64) *LimitedReadCloser

LimitReadCloser will return a limited hasCall closer.

func (*LimitedReadCloser) Close

func (l *LimitedReadCloser) Close() error

Close will close underlying reader.

func (*LimitedReadCloser) Read

func (l *LimitedReadCloser) Read(p []byte) (n int, err error)

Read is copied from io.LimitedReader's Read.

type SectionedReadCloser

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

SectionedReadCloser hasCall from underlying r and provide Close as well.

func SectionReadCloser

func SectionReadCloser(r interface {
	io.Closer
	io.ReaderAt
}, off, n int64) *SectionedReadCloser

SectionReadCloser will return a sectioned hasCall closer.

func (*SectionedReadCloser) Close

func (s *SectionedReadCloser) Close() error

Close will close underlying reader.

func (*SectionedReadCloser) Read

func (s *SectionedReadCloser) Read(p []byte) (n int, err error)

Read is copied from io.SectionReader's Read.

type SeekCloseableReader added in v0.7.0

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

SeekCloseableReader represents a reader that can also delegate io.Seeker and io.Closer interfaces to the underlying object if they are available.

func ReadSeekCloser added in v0.5.0

func ReadSeekCloser(r io.Reader) *SeekCloseableReader

ReadSeekCloser wraps a io.Reader returning a SeekCloseableReader. Allows the SDK to accept an io.Reader that is not also an io.Seeker for unsigned streaming payload API operations.

A ReadSeekCloser wrapping an nonseekable io.Reader used in an API operation's input will prevent that operation being retried in the case of network errors, and cause operation requests to fail if the operation requires payload signing.

NOTES: Idea borrows from AWS Go SDK.

func SizedReadSeekCloser added in v1.2.0

func SizedReadSeekCloser(r io.Reader, size int64) *SeekCloseableReader

SizedReadSeekCloser will return a size featured SeekCloseableReader.

func (*SeekCloseableReader) Close added in v0.7.0

func (r *SeekCloseableReader) Close() error

Close closes the SeekCloseableReader.

If the SeekCloseableReader is not an io.Closer nothing will be done.

func (*SeekCloseableReader) Read added in v0.7.0

func (r *SeekCloseableReader) Read(p []byte) (int, error)

Read reads from the reader up to size of p. The number of bytes read, and error if it occurred will be returned.

If the reader is not an io.Reader zero bytes read, and nil error will be returned.

Performs the same functionality as io.Reader Read

func (*SeekCloseableReader) Seek added in v0.7.0

func (r *SeekCloseableReader) Seek(offset int64, whence int) (int64, error)

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

If the SeekCloseableReader is not an io.Seeker nothing will be done to underlying Reader. For example: seek to end and then seek current will still return 0.

Jump to

Keyboard shortcuts

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