diff options
author | Tianon Gravi <admwiggin@gmail.com> | 2015-01-15 11:54:00 -0700 |
---|---|---|
committer | Tianon Gravi <admwiggin@gmail.com> | 2015-01-15 11:54:00 -0700 |
commit | f154da9e12608589e8d5f0508f908a0c3e88a1bb (patch) | |
tree | f8255d51e10c6f1e0ed69702200b966c9556a431 /src/pkg/encoding/base64/example_test.go | |
parent | 8d8329ed5dfb9622c82a9fbec6fd99a580f9c9f6 (diff) | |
download | golang-upstream/1.4.tar.gz |
Imported Upstream version 1.4upstream/1.4
Diffstat (limited to 'src/pkg/encoding/base64/example_test.go')
-rw-r--r-- | src/pkg/encoding/base64/example_test.go | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/pkg/encoding/base64/example_test.go b/src/pkg/encoding/base64/example_test.go deleted file mode 100644 index d18b856a0..000000000 --- a/src/pkg/encoding/base64/example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Keep in sync with ../base32/example_test.go. - -package base64_test - -import ( - "encoding/base64" - "fmt" - "os" -) - -func ExampleEncoding_EncodeToString() { - data := []byte("any + old & data") - str := base64.StdEncoding.EncodeToString(data) - fmt.Println(str) - // Output: - // YW55ICsgb2xkICYgZGF0YQ== -} - -func ExampleEncoding_DecodeString() { - str := "c29tZSBkYXRhIHdpdGggACBhbmQg77u/" - data, err := base64.StdEncoding.DecodeString(str) - if err != nil { - fmt.Println("error:", err) - return - } - fmt.Printf("%q\n", data) - // Output: - // "some data with \x00 and \ufeff" -} - -func ExampleNewEncoder() { - input := []byte("foo\x00bar") - encoder := base64.NewEncoder(base64.StdEncoding, os.Stdout) - encoder.Write(input) - // Must close the encoder when finished to flush any partial blocks. - // If you comment out the following line, the last partial block "r" - // won't be encoded. - encoder.Close() - // Output: - // Zm9vAGJhcg== -} |