util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAlignment  = errors.New("invalid alignment")
	ErrDiscouragedReader = errors.New("discouraged reader implementation")
)

Functions

func EscapeUnprintable

func EscapeUnprintable(r rune) rune

func EscapeUnprintables

func EscapeUnprintables(src string) string

func FormatSignedFixedFloat1616

func FormatSignedFixedFloat1616(val int32) string

func FormatSignedFixedFloat88

func FormatSignedFixedFloat88(val int16) string

func FormatUnsignedFixedFloat1616

func FormatUnsignedFixedFloat1616(val uint32) string

func ReadString

func ReadString(r io.Reader) (string, error)

func WriteString

func WriteString(w io.Writer, s string) error

Types

type ReadSeeker

type ReadSeeker interface {
	Reader
	io.Seeker
}

func NewReadSeeker

func NewReadSeeker(r io.ReadSeeker) ReadSeeker

type Reader

type Reader interface {
	io.Reader

	// alignment:
	//  |-1-byte-block-|--------------|--------------|--------------|
	//  |<-offset->|<-------------------width---------------------->|
	ReadBits(width uint) (data []byte, err error)

	ReadBit() (bit bool, err error)
}

func NewReader

func NewReader(r io.Reader) Reader

type Writer

type Writer interface {
	io.Writer

	// alignment:
	//  |-1-byte-block-|--------------|--------------|--------------|
	//  |<-offset->|<-------------------width---------------------->|
	WriteBits(data []byte, width uint) error

	WriteBit(bit bool) error
}

func NewWriter

func NewWriter(w io.Writer) Writer

Jump to

Keyboard shortcuts

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