xcodec

package
v0.0.0-...-f89cf20 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(codec Codec)

Types

type Codec

type Codec interface {
	Name() string
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(data []byte, v interface{}) error
}

Codec is definition of encoding can marshal/unmarshal data

func Get

func Get(name string) Codec

type StreamCodec

type StreamCodec interface {
	Encode(w io.Writer, v interface{}) error
	Decode(r io.Reader, v interface{}) error
	Name() string
}

type StreamRead

type StreamRead interface {
	Read(p []byte) error
}

type StreamReadExt

type StreamReadExt interface {
	StreamRead
	ByteOrder() binary.ByteOrder
	Codec() Codec
	ReadInt8(i *int8) error
	ReadInt16(i *int16) error
	ReadInt32(i *int32) error
	ReadInt64(i *int64) error

	ReadUint8(i *uint8) error
	ReadUint16(i *uint16) error
	ReadUint32(i *uint32) error
	ReadUint64(i *uint64) error

	ReadFloat32(f *float32) error
	ReadFloat64(f *float64) error

	ReadString(str *string) error

	ReadBool(b *bool) error

	ReadAny(v interface{}) error
}

type StreamWrite

type StreamWrite interface {
	Write(p []byte) error
}

type StreamWriteExt

type StreamWriteExt interface {
	StreamWrite
	ByteOrder() binary.ByteOrder
	Codec() Codec
	WriteInt8(i int8) error
	WriteInt16(i int16) error
	WriteInt32(i int32) error
	WriteInt64(i int64) error

	WriteUint8(i uint8) error
	WriteUint16(i uint16) error
	WriteUint32(i uint32) error
	WriteUint64(i uint64) error

	WriteFloat32(f float32) error
	WriteFloat64(f float64) error

	WriteString(str string) error

	WriteBool(b bool) error

	WriteAny(v interface{}) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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