encoding

package
v0.0.0-...-d5190fc Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotExist = fmt.Errorf("does not exist")

Functions

func Decode

func Decode(decoder Decoder, writer io.Writer, reader io.Reader) error

func DecodeString

func DecodeString(decoder Decoder, reader io.Reader) (string, error)

func Encode

func Encode(encoder Encoder, writer io.Writer, reader io.Reader) error

func EncodeString

func EncodeString(encoder Encoder, str string) ([]byte, error)

Types

type Codec

type Codec interface {
	Encoder
	Decoder
	Encoding() Encoding
	Alignment() int
	RuneSize() int
}

func NewLatin1

func NewLatin1() Codec

func NewLatin1Utf16

func NewLatin1Utf16() Codec

func NewUTF16

func NewUTF16() Codec

func NewUTF16WithEndianess

func NewUTF16WithEndianess(endianess unicode.Endianness) Codec

func NewUTF8

func NewUTF8() Codec

type Decoder

type Decoder interface {
	Decode(dst io.Writer, src io.Reader) error
}

type Encoder

type Encoder interface {
	Encode(dst io.Writer, src io.Reader) error
}

type Encoding

type Encoding string
const (
	Latin1      Encoding = "latin1"
	Latin1Utf16 Encoding = "latin1+utf16"
)
const (
	UTF16   Encoding = "utf-16"
	UTF16BE Encoding = "utf-16-be"
	UTF16LE Encoding = "utf-16-le"
)
const (
	None Encoding = ""
)
const (
	UTF8 Encoding = "utf-8"
)

type Factory

type Factory interface {
	Lookup(Encoding) (Codec, bool)
	Get(Encoding) (Codec, error)
}

func DefaultFactory

func DefaultFactory() Factory

func NewFactory

func NewFactory(codecs ...Codec) Factory

Jump to

Keyboard shortcuts

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