- Sort Score
- Result 10 results
- Languages All
Results 1 - 5 of 5 for AvailableBuffer (0.12 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_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) }
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Tue Sep 03 20:55:15 UTC 2024 - 18.6K 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/bytes/example_test.go
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 } func ExampleBuffer_Cap() {
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Wed Aug 07 17:22:36 UTC 2024 - 14.9K 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)