encoding

package
v0.105.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package encoding implements hdb field type en,- and decodings.

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 decodes hdb protocol datatypes an basis of an io.Reader.

func NewDecoder

func NewDecoder(rd io.Reader, decoder func() transform.Transformer) *Decoder

NewDecoder creates a new Decoder instance based on an io.Reader.

func (*Decoder) Bool

func (d *Decoder) Bool() bool

Bool reads and returns a boolean.

func (*Decoder) Byte

func (d *Decoder) Byte() byte

Byte reads and returns a byte.

func (*Decoder) Bytes

func (d *Decoder) Bytes(p []byte)

Bytes reads into a byte slice.

func (*Decoder) CESU8Bytes

func (d *Decoder) CESU8Bytes(size int) ([]byte, error)

CESU8Bytes reads a size CESU-8 encoded byte sequence and returns an UTF-8 byte slice. - error is only returned in case of conversion errors.

func (*Decoder) Cnt

func (d *Decoder) Cnt() int

Cnt returns the value of the byte read counter.

func (*Decoder) Decimal

func (d *Decoder) Decimal() (*big.Int, int, error)

Decimal reads and returns a decimal. - error is only returned in case of conversion errors.

func (*Decoder) Dfv

func (d *Decoder) Dfv() int

Dfv returns the data format version.

func (*Decoder) Error

func (d *Decoder) Error() error

Error returns the reader error.

func (*Decoder) Fixed

func (d *Decoder) Fixed(size int) *big.Int

Fixed reads and returns a fixed decimal.

func (*Decoder) Float32

func (d *Decoder) Float32() float32

Float32 reads and returns a float32.

func (*Decoder) Float64

func (d *Decoder) Float64() float64

Float64 reads and returns a float64.

func (*Decoder) Int16

func (d *Decoder) Int16() int16

Int16 reads and returns an int16.

func (*Decoder) Int32

func (d *Decoder) Int32() int32

Int32 reads and returns an int32.

func (*Decoder) Int64

func (d *Decoder) Int64() int64

Int64 reads and returns an int64.

func (*Decoder) Int8

func (d *Decoder) Int8() int8

Int8 reads and returns an int8.

func (*Decoder) ResetCnt

func (d *Decoder) ResetCnt()

ResetCnt resets the byte read counter.

func (*Decoder) ResetError

func (d *Decoder) ResetError() error

ResetError return and resets reader error.

func (*Decoder) SetDfv

func (d *Decoder) SetDfv(dfv int)

SetDfv sets the data format version.

func (*Decoder) Skip

func (d *Decoder) Skip(cnt int)

Skip skips cnt bytes from reading.

func (*Decoder) Uint16

func (d *Decoder) Uint16() uint16

Uint16 reads and returns an uint16.

func (*Decoder) Uint32

func (d *Decoder) Uint32() uint32

Uint32 reads and returns an uint32.

func (*Decoder) Uint32ByteOrder

func (d *Decoder) Uint32ByteOrder(byteOrder binary.ByteOrder) uint32

Uint32ByteOrder reads and returns an uint32 in given byte order.

func (*Decoder) Uint64

func (d *Decoder) Uint64() uint64

Uint64 reads and returns an uint64.

type Encoder

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

Encoder encodes hdb protocol datatypes an basis of an io.Writer.

func NewEncoder

func NewEncoder(wr io.Writer, encoder func() transform.Transformer) *Encoder

NewEncoder creates a new Encoder instance.

func (*Encoder) Bool

func (e *Encoder) Bool(v bool)

Bool writes a boolean.

func (*Encoder) Byte

func (e *Encoder) Byte(b byte)

Byte writes a byte.

func (*Encoder) Bytes

func (e *Encoder) Bytes(p []byte)

Bytes writes a byte slice.

func (*Encoder) CESU8Bytes

func (e *Encoder) CESU8Bytes(p []byte) int

CESU8Bytes writes an UTF-8 byte slice as CESU-8 and returns the CESU-8 bytes written.

func (*Encoder) CESU8String

func (e *Encoder) CESU8String(s string) int

CESU8String is like WriteCesu8 with an UTF-8 string as parameter.

func (*Encoder) Decimal

func (e *Encoder) Decimal(m *big.Int, exp int)

Decimal writes a decimal value.

func (*Encoder) Fixed

func (e *Encoder) Fixed(m *big.Int, size int)

Fixed writes a fixed decimal value.

func (*Encoder) Float32

func (e *Encoder) Float32(f float32)

Float32 writes a float32.

func (*Encoder) Float64

func (e *Encoder) Float64(f float64)

Float64 writes a float64.

func (*Encoder) Int16

func (e *Encoder) Int16(i int16)

Int16 writes an int16.

func (*Encoder) Int32

func (e *Encoder) Int32(i int32)

Int32 writes an int32.

func (*Encoder) Int64

func (e *Encoder) Int64(i int64)

Int64 writes an int64.

func (*Encoder) Int8

func (e *Encoder) Int8(i int8)

Int8 writes an int8.

func (*Encoder) String

func (e *Encoder) String(s string)

String writes a string.

func (*Encoder) Uint16

func (e *Encoder) Uint16(i uint16)

Uint16 writes an uint16.

func (*Encoder) Uint32

func (e *Encoder) Uint32(i uint32)

Uint32 writes an uint32.

func (*Encoder) Uint64

func (e *Encoder) Uint64(i uint64)

Uint64 writes an uint64.

func (*Encoder) Zeroes

func (e *Encoder) Zeroes(cnt int)

Zeroes writes cnt zero byte values.

Jump to

Keyboard shortcuts

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