1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Keep in sync with ../base64/example_test.go.
15 func ExampleEncoding_EncodeToString() {
16 data := []byte("any + old & data")
17 str := base32.StdEncoding.EncodeToString(data)
20 // MFXHSIBLEBXWYZBAEYQGIYLUME======
23 func ExampleEncoding_DecodeString() {
24 str := "ONXW2ZJAMRQXIYJAO5UXI2BAAAQGC3TEEDX3XPY="
25 data, err := base32.StdEncoding.DecodeString(str)
27 fmt.Println("error:", err)
30 fmt.Printf("%q\n", data)
32 // "some data with \x00 and \ufeff"
35 func ExampleNewEncoder() {
36 input := []byte("foo\x00bar")
37 encoder := base32.NewEncoder(base32.StdEncoding, os.Stdout)
39 // Must close the encoder when finished to flush any partial blocks.
40 // If you comment out the following line, the last partial block "r"