MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / mustPeek

Method mustPeek

xmlparser/decoder.go:828–836  ·  view source on GitHub ↗

mustPeek peeks at the next n bytes without advancing the reader. If an error occurs, it sets d.err and returns false. If io.EOF is encountered, it sets d.err to a more descriptive error.

(n int)

Source from the content-addressed store, hash-verified

826// If an error occurs, it sets d.err and returns false.
827// If io.EOF is encountered, it sets d.err to a more descriptive error.
828func (d *Decoder) mustPeek(n int) ([]byte, bool) {
829 b, ok := d.peek(n)
830 if !ok {
831 if errors.Is(d.err, io.EOF) {
832 d.setSyntaxErrorf("unexpected EOF")
833 }
834 }
835 return b, ok
836}
837
838// mustPeekBuffered peeks at all currently buffered bytes without advancing the reader.
839// If no bytes are buffered, it peeks at least 1 byte.

Callers 3

TokenMethod · 0.95
checkAndDiscardPrefixMethod · 0.95
mustPeekBufferedMethod · 0.95

Calls 2

peekMethod · 0.95
setSyntaxErrorfMethod · 0.95

Tested by

no test coverage detected