System::IO::Stream class

Stream class

A base class for a variety of stream implementations. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

class Stream : public System::IDisposable

Methods

MethodDescription
virtual BeginRead(System::ArrayPtr<uint8_t>, int, int, System::AsyncCallback, System::SharedPtr<System::Object>)Initiates an asynchronous read operation.
virtual BeginWrite(System::ArrayPtr<uint8_t>, int, int, System::AsyncCallback, System::SharedPtr<System::Object>)Initiates an asynchronous write operation.
virtual Close()Closes the stream.
CopyTo(const SharedPtr<Stream>&)Copies bytes to the specified stream.
CopyTo(const SharedPtr<Stream>&, int32_t)Copies bytes to the specified stream, using the specified buffer size.
Dispose() overrideReleases all resources used by the current object and closes the stream.
virtual EndRead(System::SharedPtr<System::IAsyncResult>)Waits until the specified asynchronous read operation completes.
virtual EndWrite(System::SharedPtr<System::IAsyncResult>)Ends an asynchronous write operation. Waits until the specified asynchronous write operation completes.
virtual Flush()Clears this stream’s buffers and writes all buffered data to the underlying storage.
virtual get_CanRead() constDetermines if the stream is readable.
virtual get_CanSeek() constDetermines if the stream supports seeking.
virtual get_CanTimeout() constGets a value that determines whether the current stream can time out.
virtual get_CanWrite() constDetermines if the stream is writable.
virtual get_Length() constReturns the length of the stream in bytes.
virtual get_Position() constReturns the current position of the stream.
virtual get_ReadTimeout() constGets a value, in milliseconds, that determines how long the stream will attempt to read before timing out.
virtual get_WriteTimeout() constGets a value, in milliseconds, that determines how long the stream will attempt to write before timing out.
virtual Read(const ArrayPtr<uint8_t>&, int32_t, int32_t)Reads the specified number of bytes from the stream and writes them to the specified byte array.
virtual Read(const System::Details::ArrayView<uint8_t>&, int32_t, int32_t)Reads the specified number of bytes from the stream and writes them to the specified byte array.
Read(const System::Details::StackArray<uint8_t, N>&, int32_t, int32_t)Reads the specified number of bytes from the stream and writes them to the specified byte array.
virtual ReadByte()Reads a single byte from the stream and returns a 32-bit integer value equivalent to the value of the read byte.
virtual Seek(int64_t, SeekOrigin)Sets the position of the stream represented by the current object.
virtual set_Position(int64_t)Sets the stream’s position.
virtual set_ReadTimeout(int)Sets a value that determines whether the current stream can time out.
virtual set_WriteTimeout(int)Sets a value, in milliseconds, that determines how long the stream will attempt to read before timing out.
virtual SetLength(int64_t)Sets the length of the stream represented by the current object.
virtual Write(const ArrayPtr<uint8_t>&, int32_t, int32_t)Writes the specified subrange of bytes from the specified byte array to the stream.
virtual Write(const System::Details::ArrayView<uint8_t>&, int32_t, int32_t)Writes the specified subrange of bytes from the specified byte array to the stream.
Write(const System::Details::StackArray<uint8_t, N>&, int32_t, int32_t)Writes the specified subrange of bytes from the specified byte array to the stream.
virtual WriteByte(uint8_t)Writes the specified unsigned 8-bit integer value to the stream.

Fields

FieldDescription
static NullA stream with no underlying storage.

Typedefs

TypedefDescription
PtrAn alias for a shared pointer to this class.

See Also