MCPcopy Index your code
hub / github.com/bitfield/script / Read

Method Read

script.go:1070–1079  ·  view source on GitHub ↗

Read reads up to len(b) bytes from ra's reader into b. It returns the number of bytes read and any error encountered. At end of file, Read returns 0, [io.EOF]. If end-of-file is reached, the reader will be closed.

(b []byte)

Source from the content-addressed store, hash-verified

1068// of bytes read and any error encountered. At end of file, Read returns 0,
1069// [io.EOF]. If end-of-file is reached, the reader will be closed.
1070func (ra ReadAutoCloser) Read(b []byte) (n int, err error) {
1071 if ra.r == nil {
1072 return 0, io.EOF
1073 }
1074 n, err = ra.r.Read(b)
1075 if err == io.EOF {
1076 ra.Close()
1077 }
1078 return n, err
1079}
1080
1081func newScanner(r io.Reader) *bufio.Scanner {
1082 scanner := bufio.NewScanner(r)

Callers

nothing calls this directly

Calls 2

CloseMethod · 0.95
ReadMethod · 0.45

Tested by

no test coverage detected