io

package
v0.0.1-dev24 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOnCloseWriter

func NewOnCloseWriter(buff LenReadWriter, f func(r io.Reader, len int64) (err error)) io.WriteCloser

NewOnCloseWriter returns a write-closer whose results (and length) will be fed to the named function at the close of the returned descriptor.

You may specify any 'bytes.Buffer' like object that offers Read/Write/Len functions or leave it nil, and a default bytes.NewBuffer() will be created

Types

type LenReadWriter

type LenReadWriter interface {
	io.ReadWriter
	Len() int
}

LenReadWriter extends io.ReadWriter with a Len() func.

type OnCloseWriter

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

OnCloseWriter invokes a callback on closing.

func (*OnCloseWriter) Close

func (w *OnCloseWriter) Close() (err error)

Close closes this writer and invokes the onClose callback.

func (*OnCloseWriter) Write

func (w *OnCloseWriter) Write(in []byte) (n int, err error)

Jump to

Keyboard shortcuts

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