OXIESEC PANEL
- Current Dir:
/
/
opt
/
golang
/
1.22.0
/
src
/
encoding
/
gob
Server IP: 191.96.63.230
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/02/2024 06:09:55 PM
rwxr-xr-x
📄
codec_test.go
36.9 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
debug.go
18.25 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
dec_helpers.go
15.41 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
decgen.go
5.23 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
decode.go
40.14 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
decoder.go
7.19 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
doc.go
17.13 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
dump.go
558 bytes
02/02/2024 06:09:55 PM
rw-r--r--
📄
enc_helpers.go
9.94 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
encgen.go
3.75 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
encode.go
19 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
encoder.go
7.75 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
encoder_test.go
29.7 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
error.go
1.35 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
example_encdec_test.go
1.54 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
example_interface_test.go
2.14 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
example_test.go
1.41 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
gobencdec_test.go
19.24 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
timing_test.go
6.49 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
type.go
27.17 KB
02/02/2024 06:09:55 PM
rw-r--r--
📄
type_test.go
6.13 KB
02/02/2024 06:09:55 PM
rw-r--r--
Editing: example_test.go
Close
// Copyright 2013 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. package gob_test import ( "bytes" "encoding/gob" "fmt" "log" ) type P struct { X, Y, Z int Name string } type Q struct { X, Y *int32 Name string } // This example shows the basic usage of the package: Create an encoder, // transmit some values, receive them with a decoder. func Example_basic() { // Initialize the encoder and decoder. Normally enc and dec would be // bound to network connections and the encoder and decoder would // run in different processes. var network bytes.Buffer // Stand-in for a network connection enc := gob.NewEncoder(&network) // Will write to network. dec := gob.NewDecoder(&network) // Will read from network. // Encode (send) some values. err := enc.Encode(P{3, 4, 5, "Pythagoras"}) if err != nil { log.Fatal("encode error:", err) } err = enc.Encode(P{1782, 1841, 1922, "Treehouse"}) if err != nil { log.Fatal("encode error:", err) } // Decode (receive) and print the values. var q Q err = dec.Decode(&q) if err != nil { log.Fatal("decode error 1:", err) } fmt.Printf("%q: {%d, %d}\n", q.Name, *q.X, *q.Y) err = dec.Decode(&q) if err != nil { log.Fatal("decode error 2:", err) } fmt.Printf("%q: {%d, %d}\n", q.Name, *q.X, *q.Y) // Output: // "Pythagoras": {3, 4} // "Treehouse": {1782, 1841} }