MCPcopy Create free account
hub / github.com/chain/txvm / Read

Method Read

cmd/hex/main.go:80–102  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

78}
79
80func (r *decodeReader) Read(p []byte) (int, error) {
81 if len(p) == 0 {
82 return 0, nil
83 }
84 if r.par == 1 {
85 p[0] = r.b
86 }
87 n, err := r.r.Read(p[r.par:])
88 p = p[:r.par+n]
89 r.par = len(p) % 2
90 if r.par == 1 {
91 r.b = p[len(p)-1]
92 p = p[:len(p)-1]
93 }
94 d, err1 := hex.Decode(p, p)
95 if err1 != nil {
96 return d, err1
97 }
98 if r.par == 1 && err == io.EOF {
99 err = hex.ErrLength
100 }
101 return d, err
102}
103
104type stripSpaceReader struct {
105 r io.Reader

Callers

nothing calls this directly

Calls 2

DecodeMethod · 0.80
ReadMethod · 0.45

Tested by

no test coverage detected