writerutil

package
v0.0.0-...-2148625 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package writerutil contains io.Writer types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrefixSuffixSaver

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

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

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

Jump to

Keyboard shortcuts

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