Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 33 for Read (0.15 sec)

  1. src/bytes/reader_test.go

    		t.Errorf("r.Len(): got %d, want %d", got, want)
    	}
    	if n, err := r.Read(make([]byte, 10)); err != nil || n != 10 {
    		t.Errorf("Read failed: read %d %v", n, err)
    	}
    	if got, want := r.Len(), 1; got != want {
    		t.Errorf("r.Len(): got %d, want %d", got, want)
    	}
    	if n, err := r.Read(make([]byte, 1)); err != nil || n != 1 {
    		t.Errorf("Read failed: read %d %v; want 1, nil", n, err)
    	}
    	if got, want := r.Len(), 0; got != want {
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Mon Dec 13 18:45:54 GMT 2021
    - 8K bytes
    - Viewed (0)
  2. src/bytes/reader.go

    // The result is unaffected by any method calls except [Reader.Reset].
    func (r *Reader) Size() int64 { return int64(len(r.s)) }
    
    // Read implements the [io.Reader] interface.
    func (r *Reader) Read(b []byte) (n int, err error) {
    	if r.i >= int64(len(r.s)) {
    		return 0, io.EOF
    	}
    	r.prevRune = -1
    	n = copy(b, r.s[r.i:])
    	r.i += int64(n)
    	return
    }
    
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri Oct 13 17:10:31 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  3. src/archive/zip/zip_test.go

    	for i := 0; i < chunks; i++ {
    		_, err := io.ReadFull(rc, chunk)
    		if err != nil {
    			t.Fatal("read:", err)
    		}
    	}
    	if frag := int(size % chunkSize); frag > 0 {
    		_, err := io.ReadFull(rc, chunk[:frag])
    		if err != nil {
    			t.Fatal("read:", err)
    		}
    	}
    	gotEnd, err := io.ReadAll(rc)
    	if err != nil {
    		t.Fatal("read end:", err)
    	}
    	if !bytes.Equal(gotEnd, end) {
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Wed Mar 27 18:23:49 GMT 2024
    - 19.5K bytes
    - Viewed (0)
  4. src/archive/tar/writer.go

    	}
    	n, err := tw.curr.Write(b)
    	if err != nil && err != ErrWriteTooLong {
    		tw.err = err
    	}
    	return n, err
    }
    
    // readFrom populates the content of the current file by reading from r.
    // The bytes read must match the number of remaining bytes in the current file.
    //
    // If the current file is sparse and r is an io.ReadSeeker,
    // then readFrom uses Seek to skip past holes defined in Header.SparseHoles,
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri Oct 13 18:36:46 GMT 2023
    - 19.6K bytes
    - Viewed (0)
  5. src/cmd/asm/internal/lex/input.go

    	// Distinguish these cases using the column number, since we don't
    	// see the space itself. Note that text/scanner reports the position at the
    	// end of the token. It's where you are now, and you just read this token.
    	if tok == '(' && in.Stack.Col() == prevCol+1 {
    		// Macro has arguments. Scan list of formals.
    		acceptArg := true
    		args = []string{} // Zero length but not nil.
    	Loop:
    		for {
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Tue Aug 29 07:48:38 GMT 2023
    - 12.6K bytes
    - Viewed (0)
  6. src/archive/zip/reader.go

    type dirReader struct {
    	err error
    }
    
    func (r *dirReader) Read([]byte) (int, error) {
    	return 0, r.err
    }
    
    func (r *dirReader) Close() error {
    	return nil
    }
    
    type checksumReader struct {
    	rc    io.ReadCloser
    	hash  hash.Hash32
    	nread uint64 // number of bytes read so far
    	f     *File
    	desr  io.Reader // if non-nil, where to read the data descriptor
    	err   error     // sticky error
    }
    
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri Oct 13 18:36:46 GMT 2023
    - 27.7K bytes
    - Viewed (0)
  7. src/bufio/scan.go

    			s.buf = newBuf
    			s.end -= s.start
    			s.start = 0
    		}
    		// Finally we can read some input. Make sure we don't get stuck with
    		// a misbehaving Reader. Officially we don't need to do this, but let's
    		// be extra careful: Scanner is for safe, simple jobs.
    		for loop := 0; ; {
    			n, err := s.r.Read(s.buf[s.end:len(s.buf)])
    			if n < 0 || len(s.buf)-s.end < n {
    				s.setErr(ErrBadReadCount)
    				break
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Mon Oct 23 09:06:30 GMT 2023
    - 14.2K bytes
    - Viewed (0)
  8. src/cmd/asm/internal/asm/parse.go

    		panic(fmt.Errorf(format, args...))
    	}
    	if p.lineNum == p.errorLine {
    		// Only one error per line.
    		return
    	}
    	p.errorLine = p.lineNum
    	if p.lex != nil {
    		// Put file and line information on head of message.
    		format = "%s:%d: " + format + "\n"
    		args = append([]interface{}{p.lex.File(), p.lineNum}, args...)
    	}
    	fmt.Fprintf(p.errorWriter, format, args...)
    	p.errorCount++
    	if p.errorCount > 10 && !*flags.AllErrors {
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Wed Feb 21 14:34:57 GMT 2024
    - 36.9K bytes
    - Viewed (0)
  9. src/bufio/bufio_test.go

    	buf := make([]byte, 1)
    	if _, err := b.Read(nil); err != nil {
    		t.Fatalf("1st nil Read = %v; want nil", err)
    	}
    	if _, err := b.Read(buf); err != errFake {
    		t.Fatalf("1st Read = %v; want errFake", err)
    	}
    	if _, err := b.Read(nil); err != nil {
    		t.Fatalf("2nd nil Read = %v; want nil", err)
    	}
    	if _, err := b.Read(buf); err != nil {
    		t.Fatalf("3rd Read with buffer = %v; want nil", err)
    	}
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri Feb 10 18:56:01 GMT 2023
    - 51.5K bytes
    - Viewed (0)
  10. src/bytes/buffer_test.go

    	// check not at EOF
    	b.WriteString("abcdefghijklmnopqrstuvwxyz")
    
    	// after unsuccessful read
    	if n, err := b.Read(nil); n != 0 || err != nil {
    		t.Fatalf("Read(nil) = %d,%v; want 0,nil", n, err)
    	}
    	if err := b.UnreadByte(); err == nil {
    		t.Fatal("UnreadByte after Read(nil): got no error")
    	}
    
    	// after successful read
    	if _, err := b.ReadBytes('m'); err != nil {
    		t.Fatalf("ReadBytes: %v", err)
    	}
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Thu Apr 20 01:07:29 GMT 2023
    - 18.1K bytes
    - Viewed (0)
Back to top