Documentation
¶
Index ¶
- Constants
- func AddBinary(b *Builder, value []byte, options ...SegmentOption)
- func AddBitstring(b *Builder, value *BitString, options ...SegmentOption)
- func AddFloat(b *Builder, value interface{}, options ...SegmentOption)
- func AddInteger(b *Builder, value interface{}, options ...SegmentOption)
- func AddUTF(b *Builder, value string, options ...SegmentOption)
- func AddUTF8(b *Builder, value string, options ...SegmentOption)
- func AddUTF8Codepoint(b *Builder, codepoint int, options ...SegmentOption)
- func AddUTF16(b *Builder, value string, options ...SegmentOption)
- func AddUTF16Codepoint(b *Builder, codepoint int, options ...SegmentOption)
- func AddUTF32(b *Builder, value string, options ...SegmentOption)
- func AddUTF32Codepoint(b *Builder, codepoint int, options ...SegmentOption)
- func Binary(m *Matcher, variable interface{}, options ...SegmentOption)
- func BitsToInt(bits []byte, signed bool) (int64, error)
- func Bitstring(m *Matcher, variable interface{}, options ...SegmentOption)
- func ConvertEndianness(data []byte, from, to string, size uint) ([]byte, error)
- func CountBits(data []byte) uint
- func DecodeUTF8(data []byte) (string, error)
- func DecodeUTF16(data []byte, endianness string) (string, error)
- func EncodeUTF8(text string) ([]byte, error)
- func EncodeUTF16(text string, endianness string) ([]byte, error)
- func ExtractBits(data []byte, startBit, numBits uint) ([]byte, error)
- func Float(m *Matcher, variable interface{}, options ...SegmentOption)
- func GetBitValue(data []byte, bitIndex uint) (bool, error)
- func GetNativeEndianness() string
- func IntToBits(value int64, size uint, signed bool) ([]byte, error)
- func Integer(m *Matcher, variable interface{}, options ...SegmentOption)
- func IsValidUnicodeCodePoint(codePoint int) bool
- func RegisterVariable(m *Matcher, name string, variable interface{})
- func RestBinary(m *Matcher, variable interface{})
- func RestBitstring(m *Matcher, variable interface{})
- func ToBinaryString(bs *BitString) string
- func ToErlangFormat(bs *BitString) string
- func ToFunbitFormat(bs *BitString) string
- func ToHexDump(bs *BitString) string
- func UTF(m *Matcher, variable interface{}, options ...SegmentOption)
- func UTF8(m *Matcher, variable interface{}, options ...SegmentOption)
- func UTF16(m *Matcher, variable interface{}, options ...SegmentOption)
- func UTF32(m *Matcher, variable interface{}, options ...SegmentOption)
- func ValidateSegment(segment interface{}) error
- func ValidateSize(size uint, unit uint) error
- func ValidateUnicodeCodePoint(codePoint int) error
- type BitString
- type BitStringError
- type Builder
- type Matcher
- type Segment
- type SegmentOption
- type SegmentResult
Constants ¶
const ( TypeBitstring = bitstringpkg.TypeBitstring TypeBinary = bitstringpkg.TypeBinary TypeInteger = bitstringpkg.TypeInteger TypeFloat = bitstringpkg.TypeFloat TypeUTF = bitstringpkg.TypeUTF TypeUTF8 = bitstringpkg.TypeUTF8 TypeUTF16 = bitstringpkg.TypeUTF16 TypeUTF32 = bitstringpkg.TypeUTF32 )
Type constants
const ( EndiannessBig = bitstringpkg.EndiannessBig EndiannessLittle = bitstringpkg.EndiannessLittle EndiannessNative = bitstringpkg.EndiannessNative )
Endianness constants
const ( ErrOverflow = bitstringpkg.CodeOverflow ErrSignedOverflow = bitstringpkg.CodeSignedOverflow ErrInsufficientBits = bitstringpkg.CodeInsufficientBits ErrInvalidSize = bitstringpkg.CodeInvalidSize ErrInvalidType = bitstringpkg.CodeInvalidType ErrInvalidEndianness = bitstringpkg.CodeInvalidEndianness ErrBinarySizeRequired = bitstringpkg.CodeBinarySizeRequired ErrBinarySizeMismatch = bitstringpkg.CodeBinarySizeMismatch ErrInvalidBinaryData = bitstringpkg.CodeInvalidBinaryData ErrInvalidBitstringData = bitstringpkg.CodeInvalidBitstringData ErrUTFSizeSpecified = bitstringpkg.CodeUTFSizeSpecified ErrInvalidUnicodeCodepoint = bitstringpkg.CodeInvalidUnicodeCodepoint ErrTypeMismatch = bitstringpkg.CodeTypeMismatch ErrInvalidSegment = bitstringpkg.CodeInvalidSegment ErrInvalidUnit = bitstringpkg.CodeInvalidUnit ErrInvalidFloatSize = bitstringpkg.CodeInvalidFloatSize ErrUTFUnitModified = bitstringpkg.CodeUTFUnitModified )
Error code constants
const ( DefaultSizeInteger = bitstringpkg.DefaultSizeInteger DefaultSizeFloat = bitstringpkg.DefaultSizeFloat )
Default size constants
Variables ¶
This section is empty.
Functions ¶
func AddBinary ¶
func AddBinary(b *Builder, value []byte, options ...SegmentOption)
AddBinary adds binary data to the builder
func AddBitstring ¶
func AddBitstring(b *Builder, value *BitString, options ...SegmentOption)
AddBitstring adds a bitstring to the builder
func AddFloat ¶
func AddFloat(b *Builder, value interface{}, options ...SegmentOption)
AddFloat adds a float to the builder
func AddInteger ¶
func AddInteger(b *Builder, value interface{}, options ...SegmentOption)
AddInteger adds an integer to the builder
func AddUTF ¶
func AddUTF(b *Builder, value string, options ...SegmentOption)
AddUTF adds UTF-encoded string data to the builder
func AddUTF8 ¶
func AddUTF8(b *Builder, value string, options ...SegmentOption)
AddUTF8 adds UTF-8 encoded string data to the builder
func AddUTF8Codepoint ¶
func AddUTF8Codepoint(b *Builder, codepoint int, options ...SegmentOption)
AddUTF8Codepoint adds a single UTF-8 encoded codepoint to the builder This is equivalent to Erlang's <<Codepoint/utf8>>
func AddUTF16 ¶
func AddUTF16(b *Builder, value string, options ...SegmentOption)
AddUTF16 adds UTF-16 encoded string data to the builder
func AddUTF16Codepoint ¶
func AddUTF16Codepoint(b *Builder, codepoint int, options ...SegmentOption)
AddUTF16Codepoint adds a single UTF-16 encoded codepoint to the builder This is equivalent to Erlang's <<Codepoint/utf16>>
func AddUTF32 ¶
func AddUTF32(b *Builder, value string, options ...SegmentOption)
AddUTF32 adds UTF-32 encoded string data to the builder
func AddUTF32Codepoint ¶
func AddUTF32Codepoint(b *Builder, codepoint int, options ...SegmentOption)
AddUTF32Codepoint adds a single UTF-32 encoded codepoint to the builder This is equivalent to Erlang's <<Codepoint/utf32>>
func Binary ¶
func Binary(m *Matcher, variable interface{}, options ...SegmentOption)
Binary adds a binary segment to the matcher
func Bitstring ¶
func Bitstring(m *Matcher, variable interface{}, options ...SegmentOption)
Bitstring adds a bitstring segment to the matcher
func ConvertEndianness ¶
ConvertEndianness converts data between different endianness
func DecodeUTF8 ¶
DecodeUTF8 decodes UTF-8 bytes to a string
func DecodeUTF16 ¶
DecodeUTF16 decodes UTF-16 bytes to a string
func EncodeUTF8 ¶
EncodeUTF8 encodes a string to UTF-8 bytes
func EncodeUTF16 ¶
EncodeUTF16 encodes a string to UTF-16 bytes
func ExtractBits ¶
ExtractBits extracts a range of bits from data
func Float ¶
func Float(m *Matcher, variable interface{}, options ...SegmentOption)
Float adds a float segment to the matcher
func GetBitValue ¶
GetBitValue gets the value of a specific bit
func GetNativeEndianness ¶
func GetNativeEndianness() string
GetNativeEndianness returns the native endianness
func Integer ¶
func Integer(m *Matcher, variable interface{}, options ...SegmentOption)
Integer adds an integer segment to the matcher
func IsValidUnicodeCodePoint ¶
IsValidUnicodeCodePoint checks if a code point is valid Unicode
func RegisterVariable ¶
RegisterVariable registers a variable for dynamic size expressions
func RestBinary ¶
func RestBinary(m *Matcher, variable interface{})
RestBinary adds a rest binary segment to the matcher
func RestBitstring ¶
func RestBitstring(m *Matcher, variable interface{})
RestBitstring adds a rest bitstring segment to the matcher
func ToBinaryString ¶
ToBinaryString converts a bitstring to binary string representation
func ToErlangFormat ¶
ToErlangFormat converts a bitstring to Erlang format
func ToFunbitFormat ¶
ToFunbitFormat converts a bitstring to Funterm format with smart display
func UTF ¶
func UTF(m *Matcher, variable interface{}, options ...SegmentOption)
UTF adds a UTF segment to the matcher
func UTF8 ¶
func UTF8(m *Matcher, variable interface{}, options ...SegmentOption)
UTF8 adds a UTF-8 segment to the matcher
func UTF16 ¶
func UTF16(m *Matcher, variable interface{}, options ...SegmentOption)
UTF16 adds a UTF-16 segment to the matcher
func UTF32 ¶
func UTF32(m *Matcher, variable interface{}, options ...SegmentOption)
UTF32 adds a UTF-32 segment to the matcher
func ValidateSegment ¶
func ValidateSegment(segment interface{}) error
ValidateSegment validates a segment
func ValidateSize ¶
ValidateSize validates the size and unit for a segment
func ValidateUnicodeCodePoint ¶
ValidateUnicodeCodePoint validates a Unicode code point
Types ¶
type BitString ¶
type BitString = bitstringpkg.BitString
BitString represents a sequence of bits
func NewBitStringFromBits ¶
NewBitStringFromBits creates a bitstring from bits with specific length
func NewBitStringFromBytes ¶
NewBitStringFromBytes creates a bitstring from byte slice
type BitStringError ¶
type BitStringError = bitstringpkg.BitStringError
BitStringError represents a bitstring error
func NewBitStringError ¶
func NewBitStringError(code, message string) *BitStringError
NewBitStringError creates a new BitStringError with the given code and message
func NewBitStringErrorWithContext ¶
func NewBitStringErrorWithContext(code, message string, context interface{}) *BitStringError
NewBitStringErrorWithContext creates a new BitStringError with the given code, message, and context
type Segment ¶
type Segment = bitstringpkg.Segment
Segment represents a segment in bitstring operations
func NewSegment ¶
func NewSegment(value interface{}, options ...SegmentOption) *Segment
NewSegment creates a new segment
type SegmentOption ¶
type SegmentOption = bitstringpkg.SegmentOption
SegmentOption represents an option for configuring segments
func WithDynamicSizeExpression ¶
func WithDynamicSizeExpression(expression string) SegmentOption
WithDynamicSizeExpression sets a dynamic size expression for a segment
func WithEndianness ¶
func WithEndianness(endianness string) SegmentOption
WithEndianness sets the endianness for a segment
func WithSigned ¶
func WithSigned(signed bool) SegmentOption
WithSigned sets the signed flag for a segment
type SegmentResult ¶
type SegmentResult = bitstringpkg.SegmentResult
SegmentResult represents the result of a matching operation