Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 160 for readFull (0.16 sec)

  1. src/io/io_test.go

    	src := []byte("hello, world")
    	dst := make([]byte, len(src))
    	rb := bytes.NewBuffer(src)
    	wb := new(bytes.Buffer)
    	r := TeeReader(rb, wb)
    	if n, err := ReadFull(r, dst); err != nil || n != len(src) {
    		t.Fatalf("ReadFull(r, dst) = %d, %v; want %d, nil", n, err, len(src))
    	}
    	if !bytes.Equal(dst, src) {
    		t.Errorf("bytes read = %q want %q", dst, src)
    	}
    	if !bytes.Equal(wb.Bytes(), src) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 09 22:04:41 UTC 2023
    - 18.9K bytes
    - Viewed (0)
  2. internal/auth/credentials.go

    	}
    	if length <= 0 {
    		length = accessKeyMaxLen
    	}
    	if length < accessKeyMinLen {
    		return "", errors.New("auth: access key length is too short")
    	}
    
    	key := make([]byte, length)
    	if _, err := io.ReadFull(random, key); err != nil {
    		return "", err
    	}
    	for i := range key {
    		key[i] = alphaNumericTable[key[i]%alphaNumericTableLen]
    	}
    	return string(key), nil
    }
    
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue May 28 17:14:16 UTC 2024
    - 12K bytes
    - Viewed (0)
  3. src/archive/tar/reader.go

    func (tr *Reader) readHeader() (*Header, *block, error) {
    	// Two blocks of zero bytes marks the end of the archive.
    	if _, err := io.ReadFull(tr.r, tr.blk[:]); err != nil {
    		return nil, nil, err // EOF is okay here; exactly 0 bytes read
    	}
    	if bytes.Equal(tr.blk[:], zeroBlock[:]) {
    		if _, err := io.ReadFull(tr.r, tr.blk[:]); err != nil {
    			return nil, nil, err // EOF is okay here; exactly 1 block of zeros read
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 01:59:14 UTC 2024
    - 26.8K bytes
    - Viewed (0)
  4. src/crypto/internal/edwards25519/field/fe_test.go

    	x = Element{1, 1, 1, 1, 1}
    	x2.Multiply(&x, &x)
    	x2sq.Square(&x)
    
    	if x2 != x2sq {
    		t.Fatalf("all ones failed\nmul: %x\nsqr: %x\n", x2, x2sq)
    	}
    
    	var bytes [32]byte
    
    	_, err := io.ReadFull(rand.Reader, bytes[:])
    	if err != nil {
    		t.Fatal(err)
    	}
    	x.SetBytes(bytes[:])
    
    	x2.Multiply(&x, &x)
    	x2sq.Square(&x)
    
    	if x2 != x2sq {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 28 17:26:17 UTC 2023
    - 13.9K bytes
    - Viewed (0)
  5. src/net/http/cgi/host_test.go

    	}
    	res, err := http.ReadResponse(bufio.NewReader(conn), req)
    	if err != nil {
    		t.Fatalf("ReadResponse: %v", err)
    	}
    	defer res.Body.Close()
    	var buf [5000]byte
    	n, err := io.ReadFull(res.Body, buf[:])
    	if err != nil {
    		t.Fatalf("ReadFull: %d bytes, %v", n, err)
    	}
    
    	if !handlerRunning() {
    		t.Fatalf("pre-conn.Close, expected handler to still be running")
    	}
    	conn.Close()
    	closed := time.Now()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 18:29:59 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  6. src/cmd/gofmt/gofmt.go

    	// indicates a possible race with someone editing the file, so we prefer to
    	// stop to avoid corrupting it.)
    	src := make([]byte, size+1)
    	n, err := io.ReadFull(in, src)
    	switch err {
    	case nil, io.EOF, io.ErrUnexpectedEOF:
    		// io.ReadFull returns io.EOF (for an empty file) or io.ErrUnexpectedEOF
    		// (for a non-empty file) if the file was changed unexpectedly. Continue
    		// with comparing file sizes in those cases.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 19:41:17 UTC 2024
    - 15.1K bytes
    - Viewed (0)
  7. src/vendor/golang.org/x/net/nettest/conntest.go

    	var wg sync.WaitGroup
    	defer wg.Wait()
    
    	pingPonger := func(c net.Conn) {
    		defer wg.Done()
    		buf := make([]byte, 8)
    		var prev uint64
    		for {
    			if _, err := io.ReadFull(c, buf); err != nil {
    				if err == io.EOF {
    					break
    				}
    				t.Errorf("unexpected Read error: %v", err)
    			}
    
    			v := binary.LittleEndian.Uint64(buf)
    			binary.LittleEndian.PutUint64(buf, v+1)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  8. src/crypto/rsa/pkcs1v15.go

    // nonZeroRandomBytes fills the given slice with non-zero random octets.
    func nonZeroRandomBytes(s []byte, random io.Reader) (err error) {
    	_, err = io.ReadFull(random, s)
    	if err != nil {
    		return
    	}
    
    	for i := 0; i < len(s); i++ {
    		for s[i] == 0 {
    			_, err = io.ReadFull(random, s[i:i+1])
    			if err != nil {
    				return
    			}
    			// In tests, the PRNG may return all zeros so we do
    			// this to break the loop.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:21 UTC 2024
    - 12.8K bytes
    - Viewed (0)
  9. src/io/io.go

    	return c.Reader.(WriterTo).WriteTo(w)
    }
    
    // ReadAll reads from r until an error or EOF and returns the data it read.
    // A successful call returns err == nil, not err == EOF. Because ReadAll is
    // defined to read from src until EOF, it does not treat an EOF from Read
    // as an error to be reported.
    func ReadAll(r Reader) ([]byte, error) {
    	b := make([]byte, 0, 512)
    	for {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 15 17:34:10 UTC 2024
    - 21.6K bytes
    - Viewed (0)
  10. src/crypto/tls/handshake_client.go

    		// we're attempting TLS 1.2.
    		if maxVersion < VersionTLS12 && suite.flags&suiteTLS12 != 0 {
    			continue
    		}
    		hello.cipherSuites = append(hello.cipherSuites, suiteId)
    	}
    
    	_, err := io.ReadFull(config.rand(), hello.random)
    	if err != nil {
    		return nil, nil, nil, errors.New("tls: short read from Rand: " + err.Error())
    	}
    
    	// A random session ID is used to detect when the server accepted a ticket
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:10:12 UTC 2024
    - 38.6K bytes
    - Viewed (0)
Back to top