bufferutil

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BinarySerializer binaryFreeList = make(chan []byte, binaryFreeListMaxItems)

BinarySerializer provides a free list of buffers to use for serializing and deserializing primitive integer values to and from io.Readers and io.Writers.

Functions

func VarIntSerializeSize added in v0.0.2

func VarIntSerializeSize(val uint64) int

VarIntSerializeSize returns the number of bytes it would take to serialize val as a variable length integer.

func VarSliceSerializeSize added in v0.0.2

func VarSliceSerializeSize(val []byte) int

VarSliceSerializeSize returns the number of bytes it would take to serialize val as a variable length byte slice.

Types

type Deserializer added in v0.0.2

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

Deserializer implements methods that help to deserialize an Elements transaction.

func NewDeserializer added in v0.0.2

func NewDeserializer(buffer *bytes.Buffer) *Deserializer

NewDeserializer returns an instance of Deserializer.

func (*Deserializer) ReadElementsAsset added in v0.0.2

func (d *Deserializer) ReadElementsAsset() ([]byte, error)

ReadElementsAsset reads an Elements output asset form the reader's buffer

func (*Deserializer) ReadElementsNonce added in v0.0.2

func (d *Deserializer) ReadElementsNonce() ([]byte, error)

ReadElementsNonce reads a maybe non-zero Elements output nonce form the reader's buffer

func (*Deserializer) ReadElementsValue added in v0.0.2

func (d *Deserializer) ReadElementsValue() ([]byte, error)

ReadElementsValue reads the first byte to determine if the value is confidential or unconfidential, then reads the right number of bytes accordingly.

func (*Deserializer) ReadSlice added in v0.0.2

func (d *Deserializer) ReadSlice(n uint) ([]byte, error)

ReadSlice reads the next n bytes from the reader's buffer

func (*Deserializer) ReadToEnd added in v0.4.0

func (d *Deserializer) ReadToEnd() []byte

ReadToEnd returns bytes left in buffer

func (*Deserializer) ReadUint16 added in v0.0.2

func (d *Deserializer) ReadUint16() (uint16, error)

ReadUint16 reads a uint16 value from reader's buffer.

func (*Deserializer) ReadUint32 added in v0.0.2

func (d *Deserializer) ReadUint32() (uint32, error)

ReadUint32 reads a uint32 value from reader's buffer.

func (*Deserializer) ReadUint64 added in v0.0.2

func (d *Deserializer) ReadUint64() (uint64, error)

ReadUint64 reads a uint64 value from reader's buffer.

func (*Deserializer) ReadUint8 added in v0.0.2

func (d *Deserializer) ReadUint8() (uint8, error)

ReadUint8 reads a uint8 value from reader's buffer.

func (*Deserializer) ReadVarInt added in v0.0.2

func (d *Deserializer) ReadVarInt() (uint64, error)

ReadVarInt reads a variable length integer from reader's buffer and returns it as a uint64.

func (*Deserializer) ReadVarSlice added in v0.0.2

func (d *Deserializer) ReadVarSlice() ([]byte, error)

ReadVarSlice first reads the length n of the bytes, then reads the next n bytes

func (*Deserializer) ReadVector added in v0.0.2

func (d *Deserializer) ReadVector() ([][]byte, error)

ReadVector reads the length n of the array of bytes, then reads the next n array bytes

type Serializer added in v0.0.2

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

Serializer implements methods that help to serialize an Elements transaction.

func NewSerializer added in v0.0.2

func NewSerializer(buf *bytes.Buffer) *Serializer

NewSerializer returns an instance of Serializer.

func (*Serializer) Bytes added in v0.0.2

func (s *Serializer) Bytes() []byte

Bytes returns writer's buffer

func (*Serializer) WriteSlice added in v0.0.2

func (s *Serializer) WriteSlice(val []byte) error

WriteSlice appends the given byte array to the writer's buffer

func (*Serializer) WriteUint16 added in v0.0.2

func (s *Serializer) WriteUint16(val uint16) error

WriteUint16 writes the given uint8 value to writer's buffer.

func (*Serializer) WriteUint32 added in v0.0.2

func (s *Serializer) WriteUint32(val uint32) error

WriteUint32 writes the given uint32 value to writer's buffer.

func (*Serializer) WriteUint64 added in v0.0.2

func (s *Serializer) WriteUint64(val uint64) error

WriteUint64 writes the given uint64 value to writer's buffer.

func (*Serializer) WriteUint8 added in v0.0.2

func (s *Serializer) WriteUint8(val uint8) error

WriteUint8 writes the given uint8 value to writer's buffer.

func (*Serializer) WriteVarInt added in v0.0.2

func (s *Serializer) WriteVarInt(val uint64) error

WriteVarInt serializes the given value to writer's buffer using a variable number of bytes depending on its value.

func (*Serializer) WriteVarSlice added in v0.0.2

func (s *Serializer) WriteVarSlice(val []byte) error

WriteVarSlice appends the length of the given byte array as var int and the byte array itself to the writer's buffer

func (*Serializer) WriteVector added in v0.0.2

func (s *Serializer) WriteVector(v [][]byte) error

WriteVector appends an array of array bytes to the writer's buffer

Jump to

Keyboard shortcuts

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