Writes bytes from the current stream to a destination byte array.
public void WriteTo(byte[] buffer)
| parameter | description |
|---|
| buffer | Target buffer. |
| exception | condition |
|---|
| ArgumentNullException | buffer> is null. |
| ObjectDisposedException | Object has been disposed. |
The entire stream is written to the target array.
Synchronously writes this stream's bytes to the argument stream.
public override void WriteTo(Stream stream)
| parameter | description |
|---|
| stream | Destination stream. |
| exception | condition |
|---|
| ArgumentNullException | stream is null. |
| ObjectDisposedException | Object has been disposed. |
Important: This does a synchronous write, which may not be desired in some situations.
Writes bytes from the current stream to a destination byte array.
public void WriteTo(byte[] buffer, long offset, long count)
| parameter | description |
|---|
| buffer | Target buffer. |
| offset | Offset in the source stream, from which to start. |
| count | Number of bytes to write. |
| exception | condition |
|---|
| ArgumentNullException | buffer> is null. |
| ArgumentOutOfRangeException | offset is less than 0, or offset + count is beyond this stream's length. |
| ObjectDisposedException | Object has been disposed. |
Synchronously writes this stream's bytes, starting at offset, for count bytes, to the argument stream.
public void WriteTo(Stream stream, long offset, long count)
| parameter | description |
|---|
| stream | Destination stream. |
| offset | Offset in source. |
| count | Number of bytes to write. |
| exception | condition |
|---|
| ArgumentNullException | stream is null. |
| ArgumentOutOfRangeException | offset is less than 0, or offset + count is beyond this stream's length. |
| ObjectDisposedException | Object has been disposed. |
Writes bytes from the current stream to a destination byte array.
public void WriteTo(byte[] buffer, long offset, long count, int targetOffset)
| parameter | description |
|---|
| buffer | Target buffer. |
| offset | Offset in the source stream, from which to start. |
| count | Number of bytes to write. |
| targetOffset | Offset in the target byte array to start writing |
| exception | condition |
|---|
| ArgumentNullException | buffer is null |
| ArgumentOutOfRangeException | offset is less than 0, or offset + count is beyond this stream's length. |
| ArgumentOutOfRangeException | targetOffset is less than 0, or targetOffset + count is beyond the target buffer's length. |
| ObjectDisposedException | Object has been disposed. |