utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChunkPayload

func ChunkPayload(c *chunk.Chunk, e chunk.Encoding) (subChunks [][]byte, r define.Range)

ChunkPayload ..

func FromChunkPayload

func FromChunkPayload(subChunks [][]byte, r define.Range, e chunk.Encoding) (c *chunk.Chunk, err error)

FromChunkPayload ..

func MarshalNBT

func MarshalNBT(writer *bytes.Buffer, value any, name string)

MarshalNBT marshal value as its little endian NBT represents to writer. Note that this implements is stable because the key in TAG_Compound is sorted. Other features are same to NBT implement on gophertunnel.

func Uint32BinaryAdd

func Uint32BinaryAdd(uint32Bytes []byte, defaultIfNotExist []byte, delta int32) []byte

Uint32BinaryAdd decode a little endian uint32Bytes as uint32, and computes the result of uint32+delta, and then return its little endian bytes result. If len(uint32Bytes) < 4, then use defaultIfNotExist instead.

Types

type Compresser added in v0.1.6

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

Compresser ..

func NewCompresser added in v0.1.6

func NewCompresser(newReaderFunc CompresserNewReader, newWriterFunc CompresserNewWriter) *Compresser

NewCompresser ..

func (Compresser) Compress added in v0.1.6

func (c Compresser) Compress(in []byte) (result []byte, err error)

Compress ..

func (Compresser) Decompress added in v0.1.6

func (c Compresser) Decompress(in []byte) (result []byte, err error)

Decompress ..

type CompresserNewReader added in v0.1.6

type CompresserNewReader func(r io.Reader) (CompresserReader, error)

type CompresserNewWriter added in v0.1.6

type CompresserNewWriter func(w io.Writer, level int) (CompresserWriter, error)

type CompresserReader added in v0.1.6

type CompresserReader io.ReadCloser

type CompresserWriter added in v0.1.6

type CompresserWriter io.WriteCloser

Jump to

Keyboard shortcuts

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