slicewriter

package
v0.9.2202 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WriteSeeker

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

WriteSeeker is a helper object that implements the io.WriteSeeker interface. Clients can create a WriteSeeker, make a series of Write calls to add data to it (and possibly Seek calls to update previously written portions), then finally invoke BytesWritten() to get a pointer to the constructed byte slice.

func (*WriteSeeker) BytesWritten

func (sws *WriteSeeker) BytesWritten() []byte

BytesWritten returns the underlying byte slice for the WriteSeeker, containing the data written to it via Write/Seek calls.

func (*WriteSeeker) Read

func (sws *WriteSeeker) Read(p []byte) (n int, err error)

func (*WriteSeeker) Seek

func (sws *WriteSeeker) Seek(offset int64, whence int) (int64, error)

Seek repositions the read/write position of the WriteSeeker within its internally maintained slice. Note that it is not possible to expand the size of the slice using SEEK_SET; trying to seek outside the slice will result in an error.

func (*WriteSeeker) Write

func (sws *WriteSeeker) 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