- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for AvailableBuffer (0.11 sec)
-
src/bufio/example_test.go
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 } // ExampleWriter_ReadFrom demonstrates how to use the ReadFrom method of Writer.
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Fri Nov 01 21:52:12 UTC 2024 - 5.5K bytes - Viewed (0) -
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):] }
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Tue Oct 29 16:47:05 UTC 2024 - 15.7K bytes - Viewed (0) -
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.
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Fri Nov 01 21:52:12 UTC 2024 - 51.6K bytes - Viewed (0)