Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for buf1 (0.02 sec)

  1. src/bufio/bufio_test.go

    }
    
    func TestWriterReset(t *testing.T) {
    	var buf1, buf2, buf3, buf4, buf5 strings.Builder
    	w := NewWriter(&buf1)
    	w.WriteString("foo")
    
    	w.Reset(&buf2) // and not flushed
    	w.WriteString("bar")
    	w.Flush()
    	if buf1.String() != "" {
    		t.Errorf("buf1 = %q; want empty", buf1.String())
    	}
    	if buf2.String() != "bar" {
    		t.Errorf("buf2 = %q; want bar", buf2.String())
    	}
    
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Fri Nov 01 21:52:12 UTC 2024
    - 51.6K bytes
    - Viewed (0)
  2. cmd/erasure-object.go

    		// We use 2 buffers, so we always have a full buffer of input.
    		pool := globalBytePoolCap.Load()
    		bufA := pool.Get()
    		bufB := pool.Get()
    		defer pool.Put(bufA)
    		defer pool.Put(bufB)
    		ra, err := readahead.NewReaderBuffer(data, [][]byte{bufA[:fi.Erasure.BlockSize], bufB[:fi.Erasure.BlockSize]})
    		if err == nil {
    			toEncode = ra
    			defer ra.Close()
    		}
    		bugLogIf(ctx, err)
    	}
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Thu Oct 31 22:10:24 UTC 2024
    - 78.8K bytes
    - Viewed (0)
  3. src/bytes/buffer.go

    // The zero value for Buffer is an empty buffer ready to use.
    type Buffer struct {
    	buf      []byte // contents are the bytes buf[off : len(buf)]
    	off      int    // read at &buf[off], write at &buf[len(buf)]
    	lastRead readOp // last read operation, so that Unread* can work correctly.
    }
    
    // The readOp constants describe the last action performed on
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Oct 29 16:47:05 UTC 2024
    - 15.7K bytes
    - Viewed (0)
  4. src/bufio/example_test.go

    		w.Write(b)
    	}
    	w.Flush()
    	// Output: 1 2 3 4
    }
    
    // ExampleWriter_ReadFrom demonstrates how to use the ReadFrom method of Writer.
    func ExampleWriter_ReadFrom() {
    	var buf bytes.Buffer
    	writer := bufio.NewWriter(&buf)
    
    	data := "Hello, world!\nThis is a ReadFrom example."
    	reader := strings.NewReader(data)
    
    	n, err := writer.ReadFrom(reader)
    	if err != nil {
    		fmt.Println("ReadFrom Error:", err)
    		return
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Fri Nov 01 21:52:12 UTC 2024
    - 5.5K bytes
    - Viewed (0)
Back to top