buffer

package
v0.0.0-...-2a67805 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

Buffer encapsulates marshaling unsigned integer and byte slice values.

func New

func New(b []byte) *Buffer

New consumes b for marshaling or unmarshaling.

func (*Buffer) Consume

func (b *Buffer) Consume(n int) []byte

Consume consumes n bytes from the Buffer. It returns nil if there aren't enough bytes left.

func (*Buffer) Data

func (b *Buffer) Data() []byte

Data is unconsumed data remaining in the Buffer.

func (*Buffer) Has

func (b *Buffer) Has(n int) bool

Has returns true if n bytes are available.

func (*Buffer) Len

func (b *Buffer) Len() int

Len returns the length of the remaining bytes.

func (*Buffer) Read16

func (b *Buffer) Read16() uint16

Read16 reads a 16-bit value from the Buffer.

func (*Buffer) Read32

func (b *Buffer) Read32() uint32

Read32 reads a 32-bit value from the Buffer.

func (*Buffer) Read64

func (b *Buffer) Read64() uint64

Read64 reads a 64-bit value from the Buffer.

func (*Buffer) Read8

func (b *Buffer) Read8() uint8

Read8 reads a byte from the Buffer.

func (*Buffer) ReadBytes

func (b *Buffer) ReadBytes(p []byte)

ReadBytes reads exactly len(p) values from the Buffer.

func (*Buffer) Remaining

func (b *Buffer) Remaining() []byte

Remaining consumes and returns a copy of all remaining bytes in the Buffer.

func (*Buffer) Write16

func (b *Buffer) Write16(v uint16)

Write16 writes a 16-bit value to the Buffer.

func (*Buffer) Write32

func (b *Buffer) Write32(v uint32)

Write32 writes a 32-bit value to the Buffer.

func (*Buffer) Write64

func (b *Buffer) Write64(v uint64)

Write64 writes a 64-bit value to the Buffer.

func (*Buffer) Write8

func (b *Buffer) Write8(v uint8)

Write8 writes a byte to the Buffer.

func (*Buffer) WriteBytes

func (b *Buffer) WriteBytes(p []byte)

WriteBytes writes p to the Buffer.

func (*Buffer) WriteN

func (b *Buffer) WriteN(n int) []byte

WriteN returns a newly appended n-size Buffer to write to.

Jump to

Keyboard shortcuts

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