binary

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package binary provides helpers for encoding binary data from a spec file very loosely based on kaitai; see https://doc.kaitai.io. Only flat primitive types are supported.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

Decoder is a binary object decoder

func NewDecoder

func NewDecoder(spec *Spec) *Decoder

NewDecoder returns a new decoder with the spec

func (*Decoder) Decode

func (d *Decoder) Decode(data []byte) (types.StringMap, error)

Decode decodes the binary data using its spec

type Meta

type Meta struct {
	ID       string `yaml:"id"`
	Endian   string `yaml:"endian"`
	Encoding string `yaml:"encoding"`
}

Meta provides meta-information for the spec

type Sequence

type Sequence struct {
	ID   string `yaml:"id"`
	Type string `yaml:"type"`
	Size int    `yaml:"size"`
	// contains filtered or unexported fields
}

Sequence is a field definition

type Spec

type Spec struct {
	Meta     Meta       `yaml:"meta"`
	Sequence []Sequence `yaml:"seq"`
}

Spec defines the specification

Jump to

Keyboard shortcuts

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