varint

package
v0.0.0-...-764124a Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2017 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package varint provides the varint type V. V knows how to write and read its binary encoded representation from a reader or writer

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxVLen16 = 3
	MaxVLen32 = 5
	MaxVLen64 = 10
)
View Source
var ErrOverflow = errors.New("varint: varint overflows a 64-bit integer")

Functions

This section is empty.

Types

type V

type V uint64

V is a varint that knows how to read and write its binary form. its in-memory representation is always uint64.

After a call to ReadBinary, V can be converted to an unsigned integer. Likewise, setting V and calling WriteBinary writes V's varint value to the writer.

This implementation does not handle signed values or zig-zag encoding.

func (*V) ReadBinary

func (v *V) ReadBinary(r io.Reader) error

ReadBinary read a varint from the underlying reader. It does not read beyond the varint.

func (V) WriteBinary

func (v V) WriteBinary(w io.Writer) (err error)

WriteBinary writes the varint to the underlying writer.

Jump to

Keyboard shortcuts

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