Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for ExampleEncode (0.19 sec)

  1. src/encoding/pem/example_test.go

    	if err != nil {
    		log.Fatal(err)
    	}
    
    	fmt.Printf("Got a %T, with remaining data: %q", pub, rest)
    	// Output: Got a *rsa.PublicKey, with remaining data: "and some more"
    }
    
    func ExampleEncode() {
    	block := &pem.Block{
    		Type: "MESSAGE",
    		Headers: map[string]string{
    			"Animal": "Gopher",
    		},
    		Bytes: []byte("test"),
    	}
    
    	if err := pem.Encode(os.Stdout, block); err != nil {
    		log.Fatal(err)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 15 03:08:55 UTC 2017
    - 1.8K bytes
    - Viewed (0)
  2. src/image/png/example_test.go

    			c := color.GrayModel.Convert(img.At(x, y)).(color.Gray)
    			level := c.Y / 51 // 51 * 5 = 255
    			if level == 5 {
    				level--
    			}
    			fmt.Print(levels[level])
    		}
    		fmt.Print("\n")
    	}
    }
    
    func ExampleEncode() {
    	const width, height = 256, 256
    
    	// Create a colored image of the given width and height.
    	img := image.NewNRGBA(image.Rect(0, 0, width, height))
    
    	for y := 0; y < height; y++ {
    		for x := 0; x < width; x++ {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 21 19:47:04 UTC 2016
    - 3.6K bytes
    - Viewed (0)
  3. src/encoding/hex/example_test.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package hex_test
    
    import (
    	"encoding/hex"
    	"fmt"
    	"log"
    	"os"
    )
    
    func ExampleEncode() {
    	src := []byte("Hello Gopher!")
    
    	dst := make([]byte, hex.EncodedLen(len(src)))
    	hex.Encode(dst, src)
    
    	fmt.Printf("%s\n", dst)
    
    	// Output:
    	// 48656c6c6f20476f7068657221
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Sep 10 21:40:16 UTC 2016
    - 2.3K bytes
    - Viewed (0)
Back to top