reader

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package reader decodes a variable from buffer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader represents the data bytes for reading

func NewReader

func NewReader(b []byte) *Reader

NewReader constructs a reader

func (*Reader) Len

func (r *Reader) Len() int

Len returns the current length of the reader's data

func (*Reader) Peek added in v0.4.1

func (r *Reader) Peek(n int) ([]byte, error)

Peek returns the next n bytes in the reader without advancing in the stream

func (*Reader) PeekUint16 added in v0.4.1

func (r *Reader) PeekUint16() (res uint16, err error)

PeekUint16 peeks the next two bytes interpreted as big-endian two-byte integer

func (*Reader) Read

func (r *Reader) Read(n int) ([]byte, error)

Read reads n bytes and returns it

func (*Reader) ReadCount added in v0.4.1

func (r *Reader) ReadCount() int

ReadCount returns the number of bytes that have been read from this Reader in total

func (*Reader) Uint16

func (r *Reader) Uint16() (uint16, error)

Uint16 reads two bytes as big-endian

func (*Reader) Uint32

func (r *Reader) Uint32() (uint32, error)

Uint32 reads four bytes as big-endian

func (*Reader) Uint64

func (r *Reader) Uint64() (uint64, error)

Uint64 reads eight bytes as big-endian

func (*Reader) Uint8

func (r *Reader) Uint8() (uint8, error)

Uint8 reads a byte

Jump to

Keyboard shortcuts

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