decoder

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2017 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package decoder contains decoder of BSON data. Modified version of gopkg.In/mgo.v2/bson decoder original: https://github.com/go-mgo/mgo/blob/v2-unstable/bson/decode.go This modified version contains some added features that could not be externally added to the original version.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	In []byte
	I  int
	// contains filtered or unexported fields
}

Decoder consists of input data and current position.

func NewDecoder

func NewDecoder(in []byte) *Decoder

NewDecoder - decoder factory.

func (*Decoder) AssertBefore

func (d *Decoder) AssertBefore(position int)

AssertBefore - assert if current decoder position is before specified.

func (*Decoder) AssertEnd

func (d *Decoder) AssertEnd(end int)

AssertEnd - assert that end has been reached.

func (*Decoder) CurrentByte

func (d *Decoder) CurrentByte() byte

CurrentByte - get current byte.

func (*Decoder) Position

func (d *Decoder) Position() int

Position gets current position.

func (*Decoder) ReadBinary

func (d *Decoder) ReadBinary() bson.Binary

ReadBinary - read binary data.

func (*Decoder) ReadBool

func (d *Decoder) ReadBool() bool

ReadBool - read boolean value.

func (*Decoder) ReadByte

func (d *Decoder) ReadByte() byte

ReadByte - read byte.

func (*Decoder) ReadBytes

func (d *Decoder) ReadBytes(length int32) []byte

ReadBytes - read N bytes.

func (*Decoder) ReadCStr

func (d *Decoder) ReadCStr() string

ReadCStr - read string of unknown length.

func (*Decoder) ReadFloat64

func (d *Decoder) ReadFloat64() float64

ReadFloat64 - read double.

func (*Decoder) ReadInt32

func (d *Decoder) ReadInt32() int32

ReadInt32 - read int32.

func (*Decoder) ReadInt64

func (d *Decoder) ReadInt64() int64

ReadInt64 - read long.

func (*Decoder) ReadLength

func (d *Decoder) ReadLength() (int, int)

ReadLength - read length of document.

func (*Decoder) ReadRegEx

func (d *Decoder) ReadRegEx() bson.RegEx

ReadRegEx - read regular expression.

func (*Decoder) ReadStr

func (d *Decoder) ReadStr() string

ReadStr - read string.

func (*Decoder) Rewind

func (d *Decoder) Rewind(rewind int)

Rewind N bytes.

func (*Decoder) Skip

func (d *Decoder) Skip(skip int)

Skip N bytes.

Jump to

Keyboard shortcuts

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