- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for UnreadByte (0.06 sec)
-
src/bytes/buffer.go
var errUnreadByte = errors.New("bytes.Buffer: UnreadByte: previous operation was not a successful read") // UnreadByte unreads the last byte returned by the most recent successful // read operation that read at least one byte. If a write has happened since // the last read, if the last read returned an error, or if the read read zero // bytes, UnreadByte returns an error. func (b *Buffer) UnreadByte() error { if b.lastRead == opInvalid {
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Tue Oct 29 16:47:05 UTC 2024 - 15.7K bytes - Viewed (0) -
src/bytes/reader.go
r.prevRune = -1 if r.i >= int64(len(r.s)) { return 0, io.EOF } b := r.s[r.i] r.i++ return b, nil } // UnreadByte complements [Reader.ReadByte] in implementing the [io.ByteScanner] interface. func (r *Reader) UnreadByte() error { if r.i <= 0 { return errors.New("bytes.Reader.UnreadByte: at beginning of slice") } r.prevRune = -1 r.i-- return nil } // ReadRune implements the [io.RuneReader] interface.
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Tue Jul 16 18:17:37 UTC 2024 - 3.9K bytes - Viewed (0) -
src/bufio/bufio_test.go
} } // Unread one byte if there is one. if n > 0 { if err := r.UnreadByte(); err != nil { t.Errorf("n = %d: unexpected error on UnreadByte: %v", n, err) } } // Test that we cannot unread any further. if err := r.UnreadByte(); err == nil { t.Errorf("n = %d: expected error on UnreadByte", n) } } } func TestUnreadByteOthers(t *testing.T) {
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Fri Nov 01 21:52:12 UTC 2024 - 51.6K bytes - Viewed (0) -
src/bytes/buffer_test.go
} func TestUnreadByte(t *testing.T) { b := new(Buffer) // check at EOF if err := b.UnreadByte(); err == nil { t.Fatal("UnreadByte at EOF: got no error") } if _, err := b.ReadByte(); err == nil { t.Fatal("ReadByte at EOF: got no error") } if err := b.UnreadByte(); err == nil { t.Fatal("UnreadByte after ReadByte at EOF: got no error") } // check not at EOF
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Tue Sep 03 20:55:15 UTC 2024 - 18.6K bytes - Viewed (0)