Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ReadSlice (0.54 sec)

  1. src/bytes/buffer.go

    func (b *Buffer) ReadBytes(delim byte) (line []byte, err error) {
    	slice, err := b.readSlice(delim)
    	// return a copy of slice. The buffer's backing array may
    	// be overwritten by later calls.
    	line = append(line, slice...)
    	return line, err
    }
    
    // readSlice is like ReadBytes but returns a reference to internal buffer data.
    func (b *Buffer) readSlice(delim byte) (line []byte, err error) {
    	i := IndexByte(b.buf[b.off:], delim)
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Oct 29 16:47:05 UTC 2024
    - 15.7K bytes
    - Viewed (0)
  2. src/bufio/bufio_test.go

    	}
    	// Test error after ReadSlice.
    	_, _, err = r.ReadRune() // reset state
    	if err != nil {
    		t.Error("unexpected error on ReadRune (4):", err)
    	}
    	_, err = r.ReadSlice(0)
    	if err != io.EOF {
    		t.Error("unexpected error on ReadSlice (4):", err)
    	}
    	if r.UnreadRune() == nil {
    		t.Error("expected error after ReadSlice (4)")
    	}
    }
    
    func TestUnreadRuneAtEOF(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)
Back to top