codec

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(b []byte) (protocol.Value, error)

func DecodeProfile

func DecodeProfile(b []byte, profile string, options DecodeOptions) (protocol.Value, error)

func DecodeWithStrict

func DecodeWithStrict(b []byte, strict bool) (protocol.Value, error)

func DeflateZlib

func DeflateZlib(b []byte) ([]byte, error)

FF AD signature followed by a zlib stream at the fastest level, mirroring the jars' PlatformZlibByteEncoder. The compressed bytes are deterministic for a given implementation but are not guaranteed byte-identical across zlib libraries, so wire-exact comparison of zlib output is reference-local.

func Encode

func Encode(v protocol.Value, profile string) ([]byte, error)

func InflateZlib

func InflateZlib(b []byte) ([]byte, error)

InflateZlib decompresses a PlatformZlib payload. It requires the FF AD signature followed by a standard zlib (RFC 1950) stream, as produced by the jars' PlatformZlibByteDecoder, and returns the inner format bytes.

func InflateZlibLimit

func InflateZlibLimit(b []byte, limit int64) ([]byte, error)

InflateZlibLimit is InflateZlib with an optional decompressed-size limit. A non-positive limit disables the limit. The reader consumes at most one byte beyond the limit, so oversized compressed payloads are rejected before unbounded output is allocated.

func IsZlib

func IsZlib(b []byte) bool

IsZlib reports whether b begins with the PlatformZlib signature (FF AD). XML, JSON, and SSV documents never begin with these bytes, so the signature is an unambiguous transport marker and is auto-detected on decode exactly as the jars do (PlatformRequest peeks the first two bytes).

Types

type DecodeOptions

type DecodeOptions struct {
	Strict             bool
	SSVUnitSeparator   string
	SSVRecordSeparator string
}

Jump to

Keyboard shortcuts

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