Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for AvailableBuffer (0.21 sec)

  1. src/bufio/example_test.go

    	fmt.Fprint(w, "Hello, ")
    	fmt.Fprint(w, "world!")
    	w.Flush() // Don't forget to flush!
    	// Output: Hello, world!
    }
    
    func ExampleWriter_AvailableBuffer() {
    	w := bufio.NewWriter(os.Stdout)
    	for _, i := range []int64{1, 2, 3, 4} {
    		b := w.AvailableBuffer()
    		b = strconv.AppendInt(b, i, 10)
    		b = append(b, ' ')
    		w.Write(b)
    	}
    	w.Flush()
    	// Output: 1 2 3 4
    }
    
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Mon Oct 23 09:06:30 GMT 2023
    - 4.9K bytes
    - Viewed (0)
  2. api/go1.18.txt

    pkg bufio, method (*Writer) AvailableBuffer() []uint8
    pkg bufio, method (ReadWriter) AvailableBuffer() []uint8
    pkg bytes, func Cut([]uint8, []uint8) ([]uint8, []uint8, bool)
    pkg bytes, func Title //deprecated
    pkg crypto/tls, method (*Conn) NetConn() net.Conn
    pkg crypto/tls, type Config struct, PreferServerCipherSuites //deprecated
    pkg crypto/x509, method (*CertPool) Subjects //deprecated
    pkg debug/buildinfo, func Read(io.ReaderAt) (*debug.BuildInfo, error)
    Plain Text
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri Feb 17 20:31:46 GMT 2023
    - 13K bytes
    - Viewed (0)
  3. src/bytes/buffer_test.go

    		empty(t, "TestWriteTo (2)", &b, s, make([]byte, len(testString)))
    	}
    }
    
    func TestWriteAppend(t *testing.T) {
    	var got Buffer
    	var want []byte
    	for i := 0; i < 1000; i++ {
    		b := got.AvailableBuffer()
    		b = strconv.AppendInt(b, int64(i), 10)
    		want = strconv.AppendInt(want, int64(i), 10)
    		got.Write(b)
    	}
    	if !Equal(got.Bytes(), want) {
    		t.Fatalf("Bytes() = %q, want %q", got, want)
    	}
    
    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)
  4. src/bufio/bufio.go

    func (b *Writer) Available() int { return len(b.buf) - b.n }
    
    // AvailableBuffer returns an empty buffer with b.Available() capacity.
    // This buffer is intended to be appended to and
    // passed to an immediately succeeding [Writer.Write] call.
    // The buffer is only valid until the next write operation on b.
    func (b *Writer) AvailableBuffer() []byte {
    	return b.buf[b.n:][:0]
    }
    
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Thu Oct 12 14:39:08 GMT 2023
    - 21.8K bytes
    - Viewed (0)
  5. src/bytes/example_test.go

    	buf := bytes.Buffer{}
    	buf.Write([]byte{'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'})
    	os.Stdout.Write(buf.Bytes())
    	// Output: hello world
    }
    
    func ExampleBuffer_AvailableBuffer() {
    	var buf bytes.Buffer
    	for i := 0; i < 4; i++ {
    		b := buf.AvailableBuffer()
    		b = strconv.AppendInt(b, int64(i), 10)
    		b = append(b, ' ')
    		buf.Write(b)
    	}
    	os.Stdout.Write(buf.Bytes())
    	// Output: 0 1 2 3
    }
    
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
  6. src/bytes/buffer.go

    func (b *Buffer) Bytes() []byte { return b.buf[b.off:] }
    
    // AvailableBuffer returns an empty buffer with b.Available() capacity.
    // This buffer is intended to be appended to and
    // passed to an immediately succeeding [Buffer.Write] call.
    // The buffer is only valid until the next write operation on b.
    func (b *Buffer) AvailableBuffer() []byte { return b.buf[len(b.buf):] }
    
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri Oct 13 17:10:31 GMT 2023
    - 15.7K bytes
    - Viewed (0)
  7. api/go1.21.txt

    pkg bytes, func ContainsFunc([]uint8, func(int32) bool) bool #54386
    pkg bytes, method (*Buffer) AvailableBuffer() []uint8 #53685
    pkg bytes, method (*Buffer) Available() int #53685
    pkg cmp, func Compare[$0 Ordered]($0, $0) int #59488
    pkg cmp, func Less[$0 Ordered]($0, $0) bool #59488
    pkg cmp, type Ordered interface {} #59488
    pkg context, func AfterFunc(Context, func()) func() bool #57928
    Plain Text
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Mon Aug 07 09:39:17 GMT 2023
    - 25.6K bytes
    - Viewed (0)
  8. src/bufio/bufio_test.go

    	got := new(bytes.Buffer)
    	var want []byte
    	rn := rand.New(rand.NewSource(0))
    	w := NewWriterSize(got, 64)
    	for i := 0; i < 100; i++ {
    		// Obtain a buffer to append to.
    		b := w.AvailableBuffer()
    		if w.Available() != cap(b) {
    			t.Fatalf("Available() = %v, want %v", w.Available(), cap(b))
    		}
    
    		// While not recommended, it is valid to append to a shifted buffer.
    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)
Back to top