cbor

package module
v0.0.0-...-267653f Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2015 License: Apache-2.0 Imports: 18 Imported by: 0

README

Concise Binary Object Representation Golang implementation (RFC7049)

This is a extensive high performance implementation of the CBOR (RFC7049) proposed standard data format.

Documentation

Index

Constants

View Source
const (
	URI reflect.Kind

	MIME
)

type constants used on blind decode

Variables

This section is empty.

Functions

func LookupExtensionFn

func LookupExtensionFn(t reflect.Type) (handleDecFn, error)

Lookup for a registered function that handles the given type decode

func RegisterExtensionFn

func RegisterExtensionFn(t reflect.Type, fn handleDecFn) error

Registers a new function to hanle decode of extensions

func RegisterTagExtensionFn

func RegisterTagExtensionFn(tagInfo uint64, fn handleTagDecFn) error

Registers a new funtion to handle decode of tag extensions

Types

type CBORMIME

type CBORMIME struct {
	ContentType string
	Params      map[string]string
}

CBORMIME

type CanonicalModeError

type CanonicalModeError struct {
	Msg string
}

A CanonicalModeError describes an invalid operation that violates the section 3.9. Canonical CBOR definition of the RFC7049

func NewCanonicalModeError

func NewCanonicalModeError(msg string) *CanonicalModeError

func (*CanonicalModeError) Error

func (e *CanonicalModeError) Error() string

type Composer

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

Composes a 'data item'

func NewComposer

func NewComposer(w io.Writer) *Composer

Create a new Composer with the given io.Writer and returns back it's address

type Decoder

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

A Decoder reads and decode CBOR objects from an input stream.

func NewDecoder

func NewDecoder(r io.Reader, options ...func(*Decoder)) *Decoder

NewDecoder returns a new decoder that reads from r.

func (*Decoder) Decode

func (dec *Decoder) Decode(v interface{}) (err error)

Decode reads the next CBOR-encoded value from its input and stores it in the value pointed to by v. It also checks for the well-formedness of the 'data item'

type Encoder

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

An Encoder writes and encode CBOR objects to an output stream

func NewEncoder

func NewEncoder(w io.Writer, options ...func(*Encoder)) *Encoder

NewEncoder returns a new encoder that write to w

func (*Encoder) Encode

func (enc *Encoder) Encode(v interface{}) (err error)

Encoder takes any object passed as parameter and writes it into a io.Writer using the C.B.O.R encoding format.

type InvalidDecodeError

type InvalidDecodeError struct {
	Type reflect.Type
}

An InvalidDecoderError describes an invalid argument passed to Decode (The argument to Decode must be a non nil pointer)

func (*InvalidDecodeError) Error

func (e *InvalidDecodeError) Error() string

type Major

type Major byte

func (Major) String

func (i Major) String() string

type Parser

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

Parses a 'data item' and checks it's well-formedness

It defines an internal buffer that is used to check the well-formedness of the 'data item' and to store data to be processed later

func NewParser

func NewParser(r io.Reader) *Parser

Create a new Parser with the given io.Reader and resturns back it's address

type ParserErr

type ParserErr struct {
	Msg string
}

errors returned by the parser

func NewParseErr

func NewParseErr(msg string) ParserErr

creates a new ParseErr component and return it back

func (ParserErr) Error

func (pe ParserErr) Error() string

implements the Error interface

type StrictModeError

type StrictModeError struct {
	Msg string
}

An StrictModeError describes an invalid operation that violates the section 3.10. Strict Mode definition of the RFC7049

func NewStrictModeError

func NewStrictModeError(msg string) *StrictModeError

func (*StrictModeError) Error

func (e *StrictModeError) Error() string

Jump to

Keyboard shortcuts

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