io

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 3 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

This section is empty.

Functions

func NewMultiWriteCloser

func NewMultiWriteCloser(writeClosers ...io.WriteCloser) io.WriteCloser

NewMultiWriteCloser creates a new io.WriteCloser that duplicates its writes to all the provided writers.

func ReadString

func ReadString(r io.Reader) (string, error)

ReadString reads from the given reader and returns the content as a string.

func ToReadCloser

func ToReadCloser(r io.Reader) io.ReadCloser

ToReadCloser creates an io.ReadCloser from the given io.Reader. If it's not already, one will be created with a Close method that does nothing.

func ToWriteCloser

func ToWriteCloser(w io.Writer) io.WriteCloser

ToWriteCloser creates an io.WriteCloser from the given io.Writer. If it's not already, one will be created with a Close method that does nothing.

Types

type FlexiWriter

type FlexiWriter interface {
	io.Writer
	io.ByteWriter
	WriteString(s string) (int, error)
	WriteRune(r rune) (int, error)
}

As implemented by strings.Builder.

type HasBytesWriter

type HasBytesWriter struct {
	Match   bool
	Pattern []byte
	// contains filtered or unexported fields
}

HasBytesWriter is a writer that will set Match to true if the given pattern is found in the stream.

func (*HasBytesWriter) Write

func (h *HasBytesWriter) Write(p []byte) (n int, err error)

type OpenReadSeekCloser

type OpenReadSeekCloser func() (ReadSeekCloser, error)

OpenReadSeekCloser allows setting some other way (than reading from a filesystem) to open or create a ReadSeekCloser.

type ReadSeekCloser

type ReadSeekCloser interface {
	ReadSeeker
	io.Closer
}

ReadSeekCloser is implemented by afero.File. We use this as the common type for content in Resource objects, even for strings.

type ReadSeekCloserProvider

type ReadSeekCloserProvider interface {
	ReadSeekCloser() (ReadSeekCloser, error)
}

ReadSeekCloserProvider provides a ReadSeekCloser.

type ReadSeeker

type ReadSeeker interface {
	io.Reader
	io.Seeker
}

ReadSeeker wraps io.Reader and io.Seeker.

type ReadSeekerNoOpCloser

type ReadSeekerNoOpCloser struct {
	ReadSeeker
}

ReadSeekerNoOpCloser implements ReadSeekCloser by doing nothing in Close. TODO(bep) rename this and similar to ReadSeekerNopCloser, naming used in stdlib, which kind of makes sense.

func NewReadSeekerNoOpCloserFromBytes

func NewReadSeekerNoOpCloserFromBytes(content []byte) ReadSeekerNoOpCloser

NewReadSeekerNoOpCloserFromBytes uses strings.NewReader to create a new ReadSeekerNoOpCloser from the given bytes slice.

func NewReadSeekerNoOpCloserFromString

func NewReadSeekerNoOpCloserFromString(content string) ReadSeekerNoOpCloser

NewReadSeekerNoOpCloserFromString uses strings.NewReader to create a new ReadSeekerNoOpCloser from the given string.

func (ReadSeekerNoOpCloser) Close

func (r ReadSeekerNoOpCloser) Close() error

Close does nothing.

type StringReader

type StringReader interface {
	ReadString() string
}

StringReader provides a way to read a string.

Jump to

Keyboard shortcuts

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