# BufferedOutputStream constructor

BufferedOutputStream(

1. OutputStream output, {
2. int bufferSize = _defaultBufferSize,

})

Creates a new buffered output stream to write data to the specified underlying output stream.

## Parameters

- `output`: The underlying output stream
- `bufferSize`: The buffer size (default: 8192 bytes)

## Example

    final buffered = BufferedOutputStream(FileOutputStream('output.bin'));
    final largeBuffered = BufferedOutputStream(
      FileOutputStream('huge_output.bin'),
      bufferSize: 65536
    );

The class implements a buffered output stream.

By setting up such an output stream, an application can write bytes to the underlying output stream without necessarily causing a call to the underlying system for each byte written.

## Example Usage

    // Basic buffered writing
    final buffered = BufferedOutputStream(FileOutputStream('output.bin'));
    try {
      for (int i = 0; i < 10000; i++) {
        await buffered.writeByte(i % 256);
      }
      await buffered.flush(); // Ensure all data is written
    } finally {
      await buffered.close();
    }

    // Writing large amounts of data efficiently
    final buffered = BufferedOutputStream(
      FileOutputStream('large_output.bin'),
      bufferSize: 65536 // 64KB buffer
    );
    try {
      final data = generateLargeDataSet();
      await buffered.write(data);
      await buffered.flush();
    } finally {
      await buffered.close();
    }

## Implementation

    BufferedOutputStream(OutputStream output, {int bufferSize = _defaultBufferSize})
        : _output = output,
          _buffer = Uint8List(bufferSize);