MCPcopy
hub / github.com/pquerna/ffjson / ReadByteNoWS

Method ReadByteNoWS

fflib/v1/reader.go:78–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76}
77
78func (r *ffReader) ReadByteNoWS() (byte, error) {
79 if r.i >= r.l {
80 return 0, io.EOF
81 }
82
83 j := r.i
84
85 for {
86 c := r.s[j]
87 j++
88
89 // inline whitespace parsing gives another ~8% performance boost
90 // for many kinds of nicely indented JSON.
91 // ... and using a [255]bool instead of multiple ifs, gives another 2%
92 /*
93 if c != '\t' &&
94 c != '\n' &&
95 c != '\v' &&
96 c != '\f' &&
97 c != '\r' &&
98 c != ' ' {
99 r.i = j
100 return c, nil
101 }
102 */
103 if whitespaceLookupTable[c] == false {
104 r.i = j
105 return c, nil
106 }
107
108 if j >= r.l {
109 return 0, io.EOF
110 }
111 }
112}
113
114func (r *ffReader) ReadByte() (byte, error) {
115 if r.i >= r.l {

Callers 1

scanReadByteMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected