- Sort Score
- Result 10 results
- Languages All
Results 1 - 7 of 7 for ReadRune (0.31 sec)
-
src/bytes/reader_test.go
if _, _, err := reader.ReadRune(); err != nil { // should not happen t.Fatal(err) } tt.f(reader) err := reader.UnreadRune() if err == nil { t.Errorf("Unreading after %s: expected error", tt.name) } } } func TestReaderDoubleUnreadRune(t *testing.T) { buf := NewBuffer([]byte("groucho")) if _, _, err := buf.ReadRune(); err != nil { // should not happen
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Mon Dec 13 18:45:54 UTC 2021 - 8K bytes - Viewed (0) -
src/bytes/reader.go
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. func (r *Reader) ReadRune() (ch rune, size int, err error) { if r.i >= int64(len(r.s)) { r.prevRune = -1 return 0, 0, io.EOF } r.prevRune = int(r.i) if c := r.s[r.i]; c < utf8.RuneSelf { r.i++
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
} } func TestUnreadRuneAtEOF(t *testing.T) { // UnreadRune/ReadRune should error at EOF (was a bug; used to panic) r := NewReader(strings.NewReader("x")) r.ReadRune() r.ReadRune() r.UnreadRune() _, _, err := r.ReadRune() if err == nil { t.Error("expected error at EOF") } else if err != io.EOF { t.Error("expected EOF; got", err) } }
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.go
c := b.buf[b.off] b.off++ b.lastRead = opRead return c, nil } // ReadRune reads and returns the next UTF-8-encoded // Unicode code point from the buffer. // If no bytes are available, the error returned is io.EOF. // If the bytes are an erroneous UTF-8 encoding, it // consumes one byte and returns U+FFFD, 1. func (b *Buffer) ReadRune() (r rune, size int, err error) { if b.empty() {
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
t.Fatal("UnreadRune at EOF: got no error") } if _, _, err := buf.ReadRune(); err == nil { t.Fatal("ReadRune at EOF: got no error") } if err := buf.UnreadRune(); err == nil { t.Fatal("UnreadRune after ReadRune at EOF: got no error") } // check not at EOF buf.Write(b) for r := rune(0); r < NRune; r++ { r1, size, _ := buf.ReadRune() if err := buf.UnreadRune(); err != nil {
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.buf[b.r] = byte(b.lastByte) b.lastByte = -1 b.lastRuneSize = -1 return nil } // ReadRune reads a single UTF-8 encoded Unicode character and returns the // rune and its size in bytes. If the encoded rune is invalid, it consumes one byte // and returns unicode.ReplacementChar (U+FFFD) with a size of 1. func (b *Reader) ReadRune() (r rune, size int, err error) {
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Thu Oct 12 14:39:08 UTC 2023 - 21.8K bytes - Viewed (0) -
api/go1.txt
pkg io, type ReaderFrom interface, ReadFrom(Reader) (int64, error) pkg io, type RuneReader interface { ReadRune } pkg io, type RuneReader interface, ReadRune() (int32, int, error) pkg io, type RuneScanner interface { ReadRune, UnreadRune } pkg io, type RuneScanner interface, ReadRune() (int32, int, error) pkg io, type RuneScanner interface, UnreadRune() error pkg io, type SectionReader struct
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Wed Aug 14 18:58:28 UTC 2013 - 1.7M bytes - Viewed (0)