go4.org: go4.org/writerutil Index | Files

package writerutil

import "go4.org/writerutil"

Package writerutil contains io.Writer types.

Index

Package Files

writerutil.go

type PrefixSuffixSaver Uses

type PrefixSuffixSaver struct {
    N int // max size of prefix or suffix
    // contains filtered or unexported fields
}

PrefixSuffixSaver is an io.Writer which retains the first N bytes and the last N bytes written to it. The Bytes method reconstructs it with a pretty error message. It is copied from os/exec/exec.go of the Go stdlib.

func (*PrefixSuffixSaver) Bytes Uses

func (w *PrefixSuffixSaver) Bytes() []byte

Bytes returns a slice of the bytes, or a copy of the bytes, retained by w. If more bytes than could be retained were written to w, it returns a concatenation of the N first bytes, a message for how many bytes were dropped, and the N last bytes.

func (*PrefixSuffixSaver) Write Uses

func (w *PrefixSuffixSaver) Write(p []byte) (n int, err error)

Package writerutil imports 2 packages (graph) and is imported by 1 packages. Updated 2017-02-17. Refresh now. Tools for package owners.