buffer

package
v0.0.0-...-bb3bbde Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadSeekBuffer

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

A Buffer is a fix-sized buffer of bytes with Read and Write methods.

func NewReadSeekBuffer

func NewReadSeekBuffer(buf []byte) *ReadSeekBuffer

NewReadSeekBuffer creates and initializes a new NewReadSeekBuffer using buf as its initial contents. It is intended to prepare a NewReadSeekBuffer to read existing data.

func (*ReadSeekBuffer) Read

func (b *ReadSeekBuffer) Read(p []byte) (n int, err error)

Read reads the next len(p) bytes from the buffer or until the buffer is drained. The return value n is the number of bytes read. If the buffer has no data to return, err is io.EOF (unless len(p) is zero); otherwise it is nil.

func (*ReadSeekBuffer) Seek

func (b *ReadSeekBuffer) Seek(offset int64, whence int) (ret int64, err error)

Seek sets the offset for the next Read on buffer to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. It returns the new offset and an error, if any.

Jump to

Keyboard shortcuts

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