bytes

package
v0.0.0-...-d85f73f Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

func NewBuffer

func NewBuffer(buf []byte) *Buffer

NewBuffer allocates a new Buffer initialized with buf, where the contents of buf are considered the unread portion of the buffer.

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

func (*Buffer) DecodeBool

func (b *Buffer) DecodeBool() (bool, error)

DecodeBool consumes an encoded raw boolean from the buffer.

func (*Buffer) DecodeByte

func (b *Buffer) DecodeByte() (byte, error)

DecodeByte consumes an encoded raw byte from the buffer.

func (*Buffer) DecodeBytes

func (b *Buffer) DecodeBytes() ([]byte, error)

DecodeBytes consumes an encoded length-prefixed raw bytes from the buffer.

func (*Buffer) DecodeBytesN

func (b *Buffer) DecodeBytesN(n uint16) ([]byte, error)

DecodeBytesN consumes an n-limited encoded raw bytes to the buffer.

func (*Buffer) DecodeInt16

func (b *Buffer) DecodeInt16() (int16, error)

DecodeUint16 consumes an encoded signed 16-bit big-endian integer from the buffer.

func (*Buffer) DecodeInt32

func (b *Buffer) DecodeInt32() (int32, error)

DecodeInt32 consumes an encoded signed 32-bit big-endian integer from the buffer.

func (*Buffer) DecodeInt64

func (b *Buffer) DecodeInt64() (int64, error)

DecodeInt64 consumes an encoded signed 64-bit big-endian integer from the buffer.

func (*Buffer) DecodeInt8

func (b *Buffer) DecodeInt8() (int8, error)

DecodeInt8 consumes an encoded signed 8-bit integer from the buffer.

func (*Buffer) DecodeRune

func (b *Buffer) DecodeRune() (rune, error)

DecodeRune consumes an encoded rune from the buffer.

func (*Buffer) DecodeString

func (b *Buffer) DecodeString() (string, error)

DecodeString consumes an encoded length-prefixed raw string from the buffer.

func (*Buffer) DecodeStringN

func (b *Buffer) DecodeStringN(n uint16) (string, error)

DecodeStringN consumes an n-limited encoded raw string to the buffer.

func (*Buffer) DecodeUint16

func (b *Buffer) DecodeUint16() (uint16, error)

DecodeUint16 consumes an encoded unsigned 16-bit big-endian integer from the buffer.

func (*Buffer) DecodeUint32

func (b *Buffer) DecodeUint32() (uint32, error)

DecodeUint32 consumes an encoded unsigned 32-bit big-endian integer from the buffer.

func (*Buffer) DecodeUint64

func (b *Buffer) DecodeUint64() (uint64, error)

DecodeUint64 consumes an encoded unsigned 64-bit big-endian integer from the buffer.

func (*Buffer) DecodeUint8

func (b *Buffer) DecodeUint8() (uint8, error)

DecodeUint8 consumes an encoded unsigned 8-bit integer from the buffer.

func (*Buffer) EncodeBool

func (b *Buffer) EncodeBool(v bool)

EncodeBool appends a raw boolean to the buffer.

func (*Buffer) EncodeByte

func (b *Buffer) EncodeByte(v byte)

EncodeByte appends a raw byte to the buffer.

func (*Buffer) EncodeBytes

func (b *Buffer) EncodeBytes(v []byte)

EncodeBytes appends a length-prefixed raw bytes to the buffer.

func (*Buffer) EncodeBytesN

func (b *Buffer) EncodeBytesN(v []byte, n uint16)

EncodeBytesN appends an n-limited length-prefixed raw bytes to the buffer.

func (*Buffer) EncodeFloat32

func (b *Buffer) EncodeFloat32(v float32)

EncodeFloat32 appends a float 32 big-endian integer to the buffer.

func (*Buffer) EncodeFloat64

func (b *Buffer) EncodeFloat64(v float64)

EncodeFloat64 appends a float 64 big-endian integer to the buffer.

func (*Buffer) EncodeInt16

func (b *Buffer) EncodeInt16(v int16)

EncodeUint16 appends a signed 16-bit big-endian integer to the buffer.

func (*Buffer) EncodeInt32

func (b *Buffer) EncodeInt32(v int32)

EncodeInt32 appends a signed 32-bit big-endian integer to the buffer.

func (*Buffer) EncodeInt64

func (b *Buffer) EncodeInt64(v int64)

EncodeInt64 appends a signed 64-bit big-endian integer to the buffer.

func (*Buffer) EncodeInt8

func (b *Buffer) EncodeInt8(v int8)

EncodeInt8 appends a signed 8-bit integer to the buffer.

func (*Buffer) EncodeRawBytes

func (b *Buffer) EncodeRawBytes(v []byte)

EncodeRawBytes appends a raw bytes to the buffer.

func (*Buffer) EncodeRawString

func (b *Buffer) EncodeRawString(v string)

EncodeRawString appends a raw string to the buffer.

func (*Buffer) EncodeRune

func (b *Buffer) EncodeRune(v rune)

EncodeRune appends a rune to the buffer.

func (*Buffer) EncodeString

func (b *Buffer) EncodeString(v string)

EncodeString appends a length-prefixed raw string to the buffer.

func (*Buffer) EncodeStringN

func (b *Buffer) EncodeStringN(v string, n uint16)

EncodeStringN appends an n-limited length-prefixed raw string to the buffer.

func (*Buffer) EncodeUint16

func (b *Buffer) EncodeUint16(v uint16)

EncodeUint16 appends an unsigned 16-bit big-endian integer to the buffer.

func (*Buffer) EncodeUint32

func (b *Buffer) EncodeUint32(u uint32)

EncodeUint32 appends an unsigned 32-bit big-endian integer to the buffer.

func (*Buffer) EncodeUint64

func (b *Buffer) EncodeUint64(v uint64)

EncodeUint64 appends an unsigned 64-bit big-endian integer to the buffer.

func (*Buffer) EncodeUint8

func (b *Buffer) EncodeUint8(v uint8)

EncodeUint8 appends an unsigned 8-bit integer to the buffer.

func (*Buffer) Index

func (b *Buffer) Index() int

func (*Buffer) Len

func (b *Buffer) Len() int

func (*Buffer) ReadBytes

func (b *Buffer) ReadBytes() ([]byte, error)

func (*Buffer) ReadInt64

func (b *Buffer) ReadInt64() (int64, error)

func (*Buffer) ReadString

func (b *Buffer) ReadString() (string, error)

func (*Buffer) ReadUint16

func (b *Buffer) ReadUint16() (uint16, error)

func (*Buffer) ReadUint32

func (b *Buffer) ReadUint32() (uint32, error)

func (*Buffer) ReadUint32Bytes

func (b *Buffer) ReadUint32Bytes() ([]byte, error)

func (*Buffer) ReadUint32String

func (b *Buffer) ReadUint32String() (string, error)

func (*Buffer) ReadUint64

func (b *Buffer) ReadUint64() (uint64, error)

func (*Buffer) ReadUint8

func (b *Buffer) ReadUint8() (uint8, error)

func (*Buffer) Reset

func (b *Buffer) Reset()

func (*Buffer) Seek

func (b *Buffer) Seek(i int)

func (*Buffer) Skip

func (b *Buffer) Skip(i int)

func (*Buffer) Write

func (b *Buffer) Write(p []byte)

func (*Buffer) WriteUint16

func (b *Buffer) WriteUint16(u uint16)

func (*Buffer) WriteUint16Bytes

func (b *Buffer) WriteUint16Bytes(p []byte)

func (*Buffer) WriteUint16LengthBytes

func (b *Buffer) WriteUint16LengthBytes(p []byte)

func (*Buffer) WriteUint16String

func (b *Buffer) WriteUint16String(s string)

func (*Buffer) WriteUint32

func (b *Buffer) WriteUint32(u uint32)

func (*Buffer) WriteUint32At

func (b *Buffer) WriteUint32At(u uint32, off int64)

func (*Buffer) WriteUint32Bytes

func (b *Buffer) WriteUint32Bytes(p []byte)

func (*Buffer) WriteUint32String

func (b *Buffer) WriteUint32String(s string)

func (*Buffer) WriteUint8

func (b *Buffer) WriteUint8(u uint8)

type Decoder

type Decoder interface {
	Decode(b *Buffer) error
}

type Encoder

type Encoder interface {
	Encode(b *Buffer)
}

type Pool

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

func NewPool

func NewPool(length int) *Pool

func (*Pool) Get

func (b *Pool) Get() *Buffer

func (*Pool) Put

func (b *Pool) Put(buf *Buffer)

Jump to

Keyboard shortcuts

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