MCPcopy Index your code
hub / github.com/CodisLabs/codis / ReadSlice

Method ReadSlice

pkg/utils/bufio2/bufio.go:115–135  ·  view source on GitHub ↗
(delim byte)

Source from the content-addressed store, hash-verified

113}
114
115func (b *Reader) ReadSlice(delim byte) ([]byte, error) {
116 if b.err != nil {
117 return nil, b.err
118 }
119 for {
120 var index = bytes.IndexByte(b.buf[b.rpos:b.wpos], delim)
121 if index >= 0 {
122 limit := b.rpos + index + 1
123 slice := b.buf[b.rpos:limit]
124 b.rpos = limit
125 return slice, nil
126 }
127 if b.buffered() == len(b.buf) {
128 b.rpos = b.wpos
129 return b.buf, bufio.ErrBufferFull
130 }
131 if b.fill() != nil {
132 return nil, b.err
133 }
134 }
135}
136
137func (b *Reader) ReadBytes(delim byte) ([]byte, error) {
138 var full [][]byte

Callers 2

ReadBytesMethod · 0.95
decodeIntMethod · 0.80

Calls 2

bufferedMethod · 0.95
fillMethod · 0.95

Tested by

no test coverage detected