Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BufferSize int = (((32 * 1024) - 2) << 4) / 29
View Source
var LineBreakAfter uint = 76
View Source
var Split = func(data []byte, atEOF bool) (advance int, token []byte, err error) { l := len(data) if atEOF && l > 0 { return l, data[:l], nil } if l < maxTokenSize { return 0, nil, nil } return maxTokenSize, data[0:maxTokenSize], nil }
Split function for input
Functions ¶
func NewDecoder ¶
NewDecoder takes an io.Reader as source to read encoded data from.
Example ¶
package main import ( "bytes" "fmt" "io/ioutil" "log" "catinello.eu/base91" ) func main() { sample := []byte("fGn/1+~j/nFa!YAS77Z.wnXBD") r := bytes.NewReader(sample) d := base91.NewDecoder(r) var w []byte _, err := d.Read(w) if err != nil { log.Fatalf("Error decoding `%s`", sample) } buf, err := ioutil.ReadAll(d) if err != nil { log.Fatal(err) } fmt.Println(string(buf)) }
Output: ABC_def→1234567890
func NewEncoder ¶
func NewEncoder(dst io.Writer) io.WriteCloser
NewEncoder takes an io.Writer as destination to write encoded data to.
Example ¶
package main import ( "bytes" "fmt" "log" "catinello.eu/base91" ) func main() { var sample []byte = []byte("ABC_def→1234567890") w := &bytes.Buffer{} e := base91.NewEncoder(w) _, err := e.Write(sample) if err != nil { log.Fatalf("Error encoding `%s`", sample) } err = e.Close() if err != nil { log.Fatalf("Error encoding `%s`", sample) } fmt.Println(w.String()) }
Output: fGn/1+~j/nFa!YAS77Z.wnXBD
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.