Documentation ¶
Index ¶
- Variables
- type CorruptInputError
- type Encoding
- func (enc *Encoding) Decode(dst, src []byte) (int, error)
- func (enc *Encoding) DecodeString(s string) ([]byte, error)
- func (enc *Encoding) DecodedLen(n int) int
- func (enc *Encoding) Encode(dst, src []byte) int
- func (enc *Encoding) EncodeToString(src []byte) string
- func (enc *Encoding) EncodedLen(n int) int
Constants ¶
This section is empty.
Variables ¶
var StdEncoding = NewEncoding(encodeStd)
StdEncoding is the standard base91 encoding (that is, the one specified at http://base91.sourceforge.net). Of the 95 printable ASCII characters, the following four are omitted: space (0x20), apostrophe (0x27), hyphen (0x2d), and backslash (0x5c).
Functions ¶
This section is empty.
Types ¶
type CorruptInputError ¶
type CorruptInputError int64
A CorruptInputError is returned if invalid base91 data is encountered during decoding.
func (CorruptInputError) Error ¶
func (e CorruptInputError) Error() string
type Encoding ¶
type Encoding struct {
// contains filtered or unexported fields
}
An Encoding is a base 91 encoding/decoding scheme defined by a 91-character alphabet.
func NewEncoding ¶
NewEncoding returns a new Encoding defined by the given alphabet, which must be a 91-byte string that does not contain CR or LF ('\r', '\n').
func (*Encoding) Decode ¶
Decode decodes src using the encoding enc. It writes at most DecodedLen(len(src)) bytes to dst and returns the number of bytes written. If src contains invalid base91 data, it will return the number of bytes successfully written and CorruptInputError.
func (*Encoding) DecodeString ¶
DecodeString returns the bytes represented by the base91 string s.
func (*Encoding) DecodedLen ¶
DecodedLen returns the maximum length in bytes of the decoded data corresponding to n bytes of base91-encoded data.
func (*Encoding) Encode ¶
Encode encodes src using the encoding enc, writing bytes to dst. It returns the number of bytes written, because the exact output size cannot be known before encoding takes place. EncodedLen(len(src)) may be used to determine an upper bound on the output size when allocating a dst slice.
func (*Encoding) EncodeToString ¶
EncodeToString returns the base91 encoding of src.
func (*Encoding) EncodedLen ¶
EncodedLen returns an upper bound on the length in bytes of the base91 encoding of an input buffer of length n. The true encoded length may be shorter.