tl

package
Version: v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2017 License: MIT Imports: 10 Imported by: 6

Documentation

Index

Constants

View Source
const (
	IDVectorLong  uint32 = 0x1cb5c415
	TagGzipPacked uint32 = 0x3072cfa1
)

Variables

View Source
var ErrMessageTooShort = errors.New("message too short")
View Source
var ErrTrailingData = errors.New("unexpected trailing data")
View Source
var ErrUnexpectedCommand = errors.New("unexpected command")

Functions

func BareBytes

func BareBytes(o Object) []byte

func Bytes

func Bytes(o Object) []byte

func BytesOf

func BytesOf(ww WritableToWriter) []byte

func CmdOfPayload

func CmdOfPayload(b []byte) uint32

func Name

func Name(o Object) string

func Pretty

func Pretty(o Object) string

func ReadBare

func ReadBare(o Object, data []byte) error

Types

type Object

type Object interface {
	Cmd() uint32
	ReadBareFrom(r *Reader)
	WriteBareTo(w *Writer)
}

type Reader

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

func DecodeObject

func DecodeObject(r *Reader) *Reader

func NewReader

func NewReader(data []byte) *Reader

func (*Reader) Cmd

func (r *Reader) Cmd() uint32

func (*Reader) Err

func (r *Reader) Err() error

func (*Reader) ExpectCmd

func (r *Reader) ExpectCmd(cmds ...uint32) bool

func (*Reader) ExpectEOF

func (r *Reader) ExpectEOF()

func (*Reader) Fail

func (r *Reader) Fail(err error)

func (*Reader) PeekCmd

func (r *Reader) PeekCmd() uint32

func (*Reader) PeekUint32

func (r *Reader) PeekUint32() uint32

func (*Reader) ReadBigInt

func (r *Reader) ReadBigInt() *big.Int

func (*Reader) ReadBlob

func (r *Reader) ReadBlob() []byte

func (*Reader) ReadBlobLen

func (r *Reader) ReadBlobLen() (int, int)

func (*Reader) ReadBool

func (r *Reader) ReadBool() bool

func (*Reader) ReadByte

func (r *Reader) ReadByte() byte

func (*Reader) ReadCmd

func (r *Reader) ReadCmd() uint32

func (*Reader) ReadFloat64

func (r *Reader) ReadFloat64() float64

func (*Reader) ReadFull

func (r *Reader) ReadFull(b []byte)

func (*Reader) ReadInt

func (r *Reader) ReadInt() int

func (*Reader) ReadN

func (r *Reader) ReadN(n int) []byte

func (*Reader) ReadString

func (r *Reader) ReadString() string

func (*Reader) ReadTimeSec32

func (r *Reader) ReadTimeSec32() time.Time

func (*Reader) ReadToEnd

func (r *Reader) ReadToEnd() []byte

func (*Reader) ReadUint128

func (r *Reader) ReadUint128(buf []byte) bool

func (*Reader) ReadUint32

func (r *Reader) ReadUint32() uint32

func (*Reader) ReadUint64

func (r *Reader) ReadUint64() uint64

func (*Reader) ReadVectorLong

func (r *Reader) ReadVectorLong() []uint64

func (*Reader) Reset

func (r *Reader) Reset(data []byte)

func (*Reader) Skip

func (r *Reader) Skip(n int)

func (*Reader) StartInnerCmd

func (r *Reader) StartInnerCmd() uint32

func (*Reader) TryReadByte

func (r *Reader) TryReadByte() (byte, bool)

func (*Reader) TryReadUint24

func (r *Reader) TryReadUint24() (uint32, bool)

func (*Reader) TryReadUint32

func (r *Reader) TryReadUint32() (uint32, bool)

func (*Reader) TryReadUint64

func (r *Reader) TryReadUint64() (uint64, bool)

type Schema

type Schema struct {
	Factory func(uint32) Object
}

func (*Schema) DescribeCmd

func (schema *Schema) DescribeCmd(cmd uint32) string

func (*Schema) DescribeCmdOfPayload

func (schema *Schema) DescribeCmdOfPayload(raw []byte) string

func (*Schema) MustReadBoxedObject

func (schema *Schema) MustReadBoxedObject(raw []byte) Object

func (*Schema) ReadBoxedObject

func (schema *Schema) ReadBoxedObject(raw []byte) (Object, error)

func (*Schema) ReadBoxedObjectFrom

func (schema *Schema) ReadBoxedObjectFrom(r *Reader) Object

func (*Schema) ReadBoxedObjectNoEOFCheck

func (schema *Schema) ReadBoxedObjectNoEOFCheck(raw []byte) (Object, error)

func (*Schema) ReadLimitedBoxedObject

func (schema *Schema) ReadLimitedBoxedObject(raw []byte, cmds ...uint32) (Object, error)

func (*Schema) ReadLimitedBoxedObjectFrom

func (schema *Schema) ReadLimitedBoxedObjectFrom(r *Reader, cmds ...uint32) Object

func (*Schema) ReadLimitedBoxedObjectNoEOFCheck

func (schema *Schema) ReadLimitedBoxedObjectNoEOFCheck(raw []byte, cmds ...uint32) (Object, error)

type WritableToWriter

type WritableToWriter interface {
	WriteTo(w *Writer)
}

type Writer

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

func NewWriter

func NewWriter() *Writer

func NewWriterCmd

func NewWriterCmd(cmd uint32) *Writer

func (*Writer) Bytes

func (w *Writer) Bytes() []byte

func (*Writer) Clear

func (w *Writer) Clear()

func (*Writer) PaddingTo

func (w *Writer) PaddingTo(bs int) int

func (*Writer) Write

func (w *Writer) Write(v []byte)

func (*Writer) WriteBigInt

func (w *Writer) WriteBigInt(v *big.Int)

func (*Writer) WriteBlob

func (w *Writer) WriteBlob(v []byte)

func (*Writer) WriteBlobLen

func (w *Writer) WriteBlobLen(v int) int

func (*Writer) WriteBool

func (w *Writer) WriteBool(v bool)

func (*Writer) WriteByte

func (w *Writer) WriteByte(v byte)

func (*Writer) WriteCmd

func (w *Writer) WriteCmd(v uint32)

func (*Writer) WriteFloat64

func (w *Writer) WriteFloat64(v float64)

func (*Writer) WriteInt

func (w *Writer) WriteInt(v int)

func (*Writer) WriteString

func (w *Writer) WriteString(s string)

func (*Writer) WriteTimeSec32

func (w *Writer) WriteTimeSec32(tm time.Time)

func (*Writer) WriteUint128

func (w *Writer) WriteUint128(v []byte)

func (*Writer) WriteUint24

func (w *Writer) WriteUint24(v uint32)

func (*Writer) WriteUint32

func (w *Writer) WriteUint32(v uint32)

func (*Writer) WriteUint64

func (w *Writer) WriteUint64(v uint64)

func (*Writer) WriteVectorLong

func (w *Writer) WriteVectorLong(v []uint64)

func (*Writer) ZeroPad

func (w *Writer) ZeroPad(n int)

Directories

Path Synopsis
cmd
tlc

Jump to

Keyboard shortcuts

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