- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for UnreadByte (0.1 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/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) -
src/bufio/bufio.go
b.r++ b.lastByte = int(c) return c, nil } // UnreadByte unreads the last byte. Only the most recently read byte can be unread. // // UnreadByte returns an error if the most recent method called on the // [Reader] was not a read operation. Notably, [Reader.Peek], [Reader.Discard], and [Reader.WriteTo] are not // considered read operations. func (b *Reader) UnreadByte() error { if b.lastByte < 0 || b.r == 0 && b.w > 0 {
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Thu Oct 12 14:39:08 UTC 2023 - 21.8K bytes - Viewed (0)