Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for readFrom (0.2 sec)

  1. src/bufio/bufio_test.go

    	n, err := w.Write([]byte("0123456789"))
    	if n != 10 || err != nil {
    		t.Fatalf("Write returned (%v, %v), want (10, nil)", n, err)
    	}
    
    	// Use ReadFrom to read in some data.
    	n2, err := w.ReadFrom(strings.NewReader("abcdef"))
    	if n2 != 6 || err != nil {
    		t.Fatalf("ReadFrom returned (%v, %v), want (6, nil)", n2, err)
    	}
    }
    
    type emptyThenNonEmptyReader struct {
    	r io.Reader
    	n int
    }
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Feb 10 18:56:01 GMT 2023
    - 51.5K bytes
    - Viewed (0)
  2. src/bytes/buffer_test.go

    func TestReadFromPanicReader(t *testing.T) {
    
    	// First verify non-panic behaviour
    	var buf Buffer
    	i, err := buf.ReadFrom(panicReader{})
    	if err != nil {
    		t.Fatal(err)
    	}
    	if i != 0 {
    		t.Fatalf("unexpected return from bytes.ReadFrom (1): got: %d, want %d", i, 0)
    	}
    	check(t, "TestReadFromPanicReader (1)", &buf, "")
    
    	// Confirm that when Reader panics, the empty buffer remains empty
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Apr 26 13:31:36 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  3. src/bytes/buffer.go

    	}
    	return copy(b.buf[m:], s), nil
    }
    
    // MinRead is the minimum slice size passed to a Read call by
    // [Buffer.ReadFrom]. As long as the [Buffer] has at least MinRead bytes beyond
    // what is required to hold the contents of r, ReadFrom will not grow the
    // underlying buffer.
    const MinRead = 512
    
    // ReadFrom reads data from r until EOF and appends it to the buffer, growing
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Oct 13 17:10:31 GMT 2023
    - 15.7K bytes
    - Viewed (0)
  4. src/archive/tar/writer.go

    	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,
    // assuming that skipped regions are all NULs.
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Oct 13 18:36:46 GMT 2023
    - 19.6K bytes
    - Viewed (0)
  5. src/bufio/bufio.go

    	n := copy(b.buf[b.n:], s)
    	b.n += n
    	nn += n
    	return nn, nil
    }
    
    // ReadFrom implements [io.ReaderFrom]. If the underlying writer
    // supports the ReadFrom method, this calls the underlying ReadFrom.
    // If there is buffered data and an underlying ReadFrom, this fills
    // the buffer and writes it before calling ReadFrom.
    func (b *Writer) ReadFrom(r io.Reader) (n int64, err error) {
    	if b.err != nil {
    		return 0, b.err
    	}
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Thu Oct 12 14:39:08 GMT 2023
    - 21.8K bytes
    - Viewed (0)
  6. src/archive/tar/writer_test.go

    					}
    				case testReadFrom:
    					f := &testFile{ops: tf.ops}
    					got, err := tw.readFrom(f)
    					if _, ok := err.(testError); ok {
    						t.Errorf("test %d, ReadFrom(): %v", i, err)
    					} else if got != tf.wantCnt || !equalError(err, tf.wantErr) {
    						t.Errorf("test %d, ReadFrom() = (%d, %v), want (%d, %v)", i, got, err, tf.wantCnt, tf.wantErr)
    					}
    					if len(f.ops) > 0 {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Tue Feb 27 16:39:23 GMT 2024
    - 38.7K bytes
    - Viewed (0)
  7. src/bytes/reader_test.go

    	type nErr struct {
    		n   int64
    		err error
    	}
    	type justReader struct {
    		io.Reader
    	}
    	type justWriter struct {
    		io.Writer
    	}
    	discard := justWriter{io.Discard} // hide ReadFrom
    
    	var with, withOut nErr
    	with.n, with.err = io.Copy(discard, NewReader(nil))
    	withOut.n, withOut.err = io.Copy(discard, justReader{NewReader(nil)})
    	if with != withOut {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Dec 13 18:45:54 GMT 2021
    - 8K bytes
    - Viewed (0)
  8. api/go1.15.txt

    pkg net/url, method (*URL) EscapedFragment() string
    pkg net/url, method (*URL) Redacted() string
    pkg net/url, type URL struct, RawFragment string
    pkg os, method (*File) ReadFrom(io.Reader) (int64, error)
    pkg os, var ErrDeadlineExceeded error
    pkg regexp, method (*Regexp) SubexpIndex(string) int
    pkg strconv, func FormatComplex(complex128, uint8, int, int) string
    Plain Text
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Fri Jul 17 02:15:01 GMT 2020
    - 7.6K bytes
    - Viewed (0)
  9. api/go1.txt

    pkg io, type ReaderAt interface { ReadAt }
    pkg io, type ReaderAt interface, ReadAt([]uint8, int64) (int, error)
    pkg io, type ReaderFrom interface { ReadFrom }
    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 }
    Plain Text
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Wed Aug 14 18:58:28 GMT 2013
    - 1.7M bytes
    - Viewed (1)
  10. api/go1.1.txt

    pkg bufio, method (*Scanner) Scan() bool
    pkg bufio, method (*Scanner) Split(SplitFunc)
    pkg bufio, method (*Scanner) Text() string
    pkg bufio, method (*Writer) ReadFrom(io.Reader) (int64, error)
    pkg bufio, method (ReadWriter) ReadFrom(io.Reader) (int64, error)
    pkg bufio, method (ReadWriter) WriteTo(io.Writer) (int64, error)
    pkg bufio, type Scanner struct
    pkg bufio, type SplitFunc func([]uint8, bool) (int, []uint8, error)
    Plain Text
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Thu Mar 31 20:37:15 GMT 2022
    - 2.6M bytes
    - Viewed (0)
Back to top