strms

package
v0.0.0-...-8218a20 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DevZero devZero

DevZero is like is like /dev/zero for reading and /dev/null for writing

View Source
var EmptyRdr io.Reader = bytes.NewReader([]byte{})

EmptyRdr is a reader that will always be empty

Functions

func NewReadFirstCloseList

func NewReadFirstCloseList(rdr io.Reader, closers ...io.Closer) io.ReadCloser

NewReadFirstCloseList is a wraper that reads the provided reader but when closed will close the provided readers. Useful when you have io.Readers wrapping io.ReadClosers.

Types

type ReadAtReader

type ReadAtReader interface {
	io.ReaderAt
	io.Reader
}

ReadAtReader is io.ReaderAt + io.Reader

func NewReadAtReader

func NewReadAtReader(rdrAt io.ReaderAt) ReadAtReader

NewReadAtReader returns a reader that using a io.ReaderAt's ReadAt in conjunction with its own position counter. This is useful when you have a io.ReaderAt that is not also a io.Reader or you want to share an io.ReaderAt that is also an io.Reader without modifying its position. For example os.File's position is on the OS/kernel side meaning normally sharing it requires locking... or using ReadAt at as we do here.

type WriterAtWriter

type WriterAtWriter interface {
	io.WriterAt
	io.Writer
}

WriterAtWriter is io.WriterAt + io.Writer

func NewWriteAtWriter

func NewWriteAtWriter(wtrAt io.WriterAt) WriterAtWriter

NewWriteAtWriter returns a writer that using a io.WriterAt's WriteAt in conjunction with its own position counter. See NewReadAtReader for a detailed explanation of why is this is often useful.

Jump to

Keyboard shortcuts

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