Copies bytes to the buffered stream and advances the current position within the buffered stream by the number of bytes written.
[Visual Basic] Overrides Public Function Write( _ ByVal array() As Byte, _ ByVal offset As Integer, _ ByVal count As Integer _ ) As Integer [C#] public override int Write( byte[] array, int offset, int count ); [C++] public: override int Write( unsigned char* array[], int offset, int count ); [JScript] public override function Write( array : Byte[], offset : int, count : int ) : int;
The number of bytes written to the stream.
Exception Type | Condition |
---|---|
ArgumentException | Length of array minus offset is less than count. |
ArgumentNullException | array is null. |
ArgumentOutOfRangeException | offset or count is less than zero. |
IOException | The stream is closed or null. |
NotSupportedException | The stream does not support writing. |
Note that BufferedStream.Read(byte[], int, int) and BufferedStream.Write(byte[], int, int) read and write the number of bytes specified by the count parameter, while StreamReader.Read(char[], int, int) and StreamReader.Write(char[], int, int) read and write the number of characters specified by the count parameter. Use the BufferedStream methods only for reading and writing an integral number of bytes.
BufferedStream Class | BufferedStream Members | System.IO Namespace | CanWrite | Read