iotools

package module
v0.0.0-...-5d42236 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseOnce

func CloseOnce(c io.Closer) io.Closer

CloseOnce wraps an io.Closer to ensure it only performs the close logic once.

func CloserAfterCallback

func CloserAfterCallback(c io.Closer, cb func()) io.Closer

func CloserCallback

func CloserCallback(c io.Closer, cb func()) io.Closer

func NopReadCloser

func NopReadCloser(r io.Reader) io.ReadCloser

NopReadCloser wraps an io.Reader to implement io.ReadCloser with empty io.Closer implementation.

func NopWriteCloser

func NopWriteCloser(w io.Writer) io.WriteCloser

NopWriteCloser wraps an io.Writer to implement io.WriteCloser with empty io.Closer implementation.

func ReadCloser

func ReadCloser(r io.Reader, c io.Closer) io.ReadCloser

ReadCloser wraps an io.Reader and io.Closer in order to implement io.ReadCloser.

func WriteCloser

func WriteCloser(w io.Writer, c io.Closer) io.WriteCloser

WriteCloser wraps an io.Writer and io.Closer in order to implement io.WriteCloser.

Types

type CloserFunc

type CloserFunc func() error

CloserFunc is a function signature which allows a function to implement the io.Closer type.

func (CloserFunc) Close

func (c CloserFunc) Close() error

type ReaderFromFunc

type ReaderFromFunc func(io.Reader) (int64, error)

ReaderFromFunc is a function signature which allows a function to implement the io.ReaderFrom type.

func (ReaderFromFunc) ReadFrom

func (rf ReaderFromFunc) ReadFrom(r io.Reader) (int64, error)

type ReaderFunc

type ReaderFunc func([]byte) (int, error)

ReaderFunc is a function signature which allows a function to implement the io.Reader type.

func (ReaderFunc) Read

func (r ReaderFunc) Read(b []byte) (int, error)

type WriterFunc

type WriterFunc func([]byte) (int, error)

WriterFunc is a function signature which allows a function to implement the io.Writer type.

func (WriterFunc) Write

func (w WriterFunc) Write(b []byte) (int, error)

type WriterToFunc

type WriterToFunc func(io.Writer) (int64, error)

WriterToFunc is a function signature which allows a function to implement the io.WriterTo type.

func (WriterToFunc) WriteTo

func (wt WriterToFunc) WriteTo(r io.Writer) (int64, error)

Jump to

Keyboard shortcuts

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