MCPcopy Create free account
hub / github.com/cloudwego/netpoll / ReadString

Method ReadString

nocopy_linkbuffer.go:296–306  ·  view source on GitHub ↗

ReadString implements Reader.

(n int)

Source from the content-addressed store, hash-verified

294
295// ReadString implements Reader.
296func (b *UnsafeLinkBuffer) ReadString(n int) (s string, err error) {
297 if n <= 0 {
298 return
299 }
300 // check whether enough or not.
301 if b.Len() < n {
302 return s, fmt.Errorf("link buffer read string[%d] not enough", n)
303 }
304 p := b.readBinary(n)
305 return unsafe.String(unsafe.SliceData(p), len(p)), nil
306}
307
308// ReadBinary implements Reader.
309func (b *UnsafeLinkBuffer) ReadBinary(n int) (p []byte, err error) {

Callers

nothing calls this directly

Calls 2

LenMethod · 0.95
readBinaryMethod · 0.95

Tested by

no test coverage detected