reader

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2017 License: BSD-2-Clause Imports: 2 Imported by: 0

README

mellium.im/reader

GoDoc License

A collection of io.Reader's that perform various useful functions.

import "mellium.im/reader"

License

The package may be used under the terms of the BSD 2-Clause License a copy of which may be found in the LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(r io.Reader, f func() error) io.Reader

After returns an io.Reader that proxies to another Reader and calls f after each Read that returns an io.EOF error. If io.EOF is never returned, f is never called and if io.EOF is returned multiple times, f will be called multiple times. If f returns an error, it is returned from the call to Read instead of io.EOF.

func Before

func Before(r io.Reader, f func() error) io.Reader

Before returns an io.Reader that proxies calls to Read and executes the given function exactly once before the first call. If the function errors, the error is returned and the call to Read is never proxied to the inner io.Reader (subsequent calls to Read will still be proxied). Because no call to Read returns until the one call to f returns, if f causes Read to be called, it will deadlock. If f panics, Read considers it to have returned; future calls of Read return without calling f. For more information see the documentation for sync.Once.

func Error

func Error(err error) io.Reader

Error returns a reader that always returns the given error for all calls to Read.

Types

This section is empty.

Jump to

Keyboard shortcuts

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