jam

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPointer           = errors.New("invalid pointer")
	ErrDecodingBool             = errors.New("error decoding boolean")
	ErrExceedingByteArrayLimit  = errors.New("byte array length exceeds max value of uint32")
	ErrUnsupportedEnumTypeValue = errors.New("unsupported enum type value")
	ErrUnknownEnumTypeValue     = errors.New("cannot find enum type value")

	ErrUnsupportedType         = "unsupported type: %T"
	ErrReadingBytes            = "error reading bytes: %w"
	ErrReadingByte             = "error reading byte: %w"
	ErrDecodingUint            = "error decoding uint: : %w"
	ErrEncodingMapFieldKeyType = "error encoding map field: unsupported map key type %v"
	ErrDecodingMapLength       = "error decoding map length: %v"
	ErrDecodingMapKey          = "error decoding map key: %v"
	ErrDecodingMapValue        = "error decoding map value: %v"
	ErrEncodingStructField     = "encoding struct field '%s': %w"
	ErrDecodingStructField     = "decoding struct field '%s': %w"
	ErrInvalidLengthValue      = "invalid length value in jam tag for field %s: %v"

	ErrUnSuportedFieldForCompactDecoding = "unsupported field kind for compact decoding: %s"
	ErrUnSuportedFieldForCompactEncoding = "unsupported field kind for compact encoding: %s"

	ErrConflictingTags = "conflicting struct tags on field %s: 'length' and 'encoding' cannot be used together"
)

Functions

func IntLength

func IntLength(in any) (uint, error)

func Marshal

func Marshal(v interface{}) ([]byte, error)

func Unmarshal

func Unmarshal(data []byte, dst interface{}) error

Types

type BitSequence

type BitSequence []bool

type Decoder

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

func NewDecoder

func NewDecoder(reader io.Reader) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(dst any) error

func (*Decoder) DecodeFixedLength

func (d *Decoder) DecodeFixedLength(dst any, length uint) error

func (*Decoder) ReadOctet

func (br *Decoder) ReadOctet() (byte, error)

type EncodeEnum

type EncodeEnum interface {
	IndexValue() (index uint, value any, err error)
}

type EnumType

type EnumType interface {
	EncodeEnum
	ValueAt(index uint) (value any, err error)
	SetValue(value any) error
}

type Marshaler

type Marshaler interface {
	MarshalJAM() ([]byte, error)
}

Marshaler is the interface implemented by types that can marshal themselves into valid JAM encoded data.

type Unmarshaler

type Unmarshaler interface {
	UnmarshalJAM(io.Reader) error
}

Unmarshaler is the interface implemented by types that can unmarshal a JAM-encoded description of themselves.

Jump to

Keyboard shortcuts

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