MCPcopy Create free account
hub / github.com/google/gvisor / readByte

Method readByte

pkg/buffer/buffer.go:584–592  ·  view source on GitHub ↗

readByte implements the io.ByteReader interface. This method is used by BufferReader to consume its underlying buffer. To perform io operations on buffers directly, use ReadToWriter or WriteToReader.

()

Source from the content-addressed store, hash-verified

582// BufferReader to consume its underlying buffer. To perform io operations on
583// buffers directly, use ReadToWriter or WriteToReader.
584func (b *Buffer) readByte() (byte, error) {
585 if b.Size() == 0 {
586 return 0, io.EOF
587 }
588 v := b.data.Front()
589 bt := v.AsSlice()[0]
590 b.TrimFront(1)
591 return bt, nil
592}
593
594// AsBufferReader returns the Buffer as a BufferReader capable of io methods.
595// The new BufferReader takes ownership of b.

Callers 2

TestReadByteFunction · 0.95
ReadByteMethod · 0.45

Calls 4

SizeMethod · 0.95
TrimFrontMethod · 0.95
FrontMethod · 0.45
AsSliceMethod · 0.45

Tested by 1

TestReadByteFunction · 0.76