byteswriter

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: MIT Imports: 2 Imported by: 1

README

byteswriter

This Go package implements a io.Writer that wraps a []byte. It's like bytes.Reader, but then a Writer.

b := make([]byte, 20)
w := byteswriter.NewWriter(b)
// use io.Writer w

See godoc documentation

Documentation

Overview

Contains a io.Writer that is backed by a []byte. It's the bytes.Writer that's missing in the Go standard library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

A Writer implements io.Writer and io.Seeker by writing to the given byteslice. Unlike a bytes.Buffer, BytesWriter does not resize the byte slice.

func NewWriter

func NewWriter(buf []byte) *Writer

Create a new writer using the given buffer

func (*Writer) Seek

func (w *Writer) Seek(offset int64, whence int) (int64, error)

func (*Writer) Write

func (w *Writer) 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