PLCnext API Documentation 25.0.2.69
Public Member Functions | List of all members
Arp::System::Commons::Io::MemoryStream Class Reference
Inheritance diagram for Arp::System::Commons::Io::MemoryStream:
Inheritance graph

Public Member Functions

 MemoryStream (void)
 Initializes a new instance of the T:System.IO.MemoryStream class with an expandable capacity initialized to zero.
 
 MemoryStream (size_t capacity)
 Initializes a new instance of the T:System.IO.MemoryStream class with an expandable capacity initialized as specified. More...
 
 MemoryStream (byte *buffer, size_t bufferSize)
 Initializes a new non-resizable instance of the T:System.IO.MemoryStream class based on the specified byte array. More...
 
 MemoryStream (byte *buffer, size_t bufferSize, boolean writable)
 Initializes a new non-resizable instance of the T:System.IO.MemoryStream class based on the specified byte array with the P:System.IO.MemoryStream.CanWrite property set as specified. More...
 
 MemoryStream (byte *buffer, size_t bufferSize, size_t index, size_t count)
 Initializes a new non-resizable instance of the T:System.IO.MemoryStream class based on the specified region (index) of a byte array. More...
 
 MemoryStream (byte *buffer, size_t bufferSize, size_t index, size_t count, boolean writable)
 Initializes a new non-resizable instance of the T:System.IO.MemoryStream class based on the specified region of a byte array, with the P:System.IO.MemoryStream.CanWrite property set as specified. More...
 
 MemoryStream (byte *buffer, size_t bufferSize, size_t index, size_t count, boolean writable, boolean publiclyVisible)
 Initializes a new instance of the T:System.IO.MemoryStream class based on the specified region of a byte array, with the P:System.IO.MemoryStream.CanWrite property set as specified, and the ability to call M:System.IO.MemoryStream.GetBuffer set as specified. More...
 
 MemoryStream (const MemoryStream &arg)=delete
 Copy constructor.
 
MemoryStreamoperator= (const MemoryStream &arg)=delete
 Assignment operator.
 
virtual ~MemoryStream (void)
 Destructs this instance and frees all resources.
 
size_t GetLength (void)
 
void SetLength (size_t value)
 
size_t GetPosition (void) override
 Gets the position of the stream, if it can seek. More...
 
void SetPosition (size_t value) override
 Sets the position of the stream, if it can seek. More...
 
size_t GetCapacity (void)
 
void SetCapacity (size_t value)
 
size_t Seek (size_t offset, SeekOrigin origin) override
 
size_t Read (byte *pBuffer, size_t bufferSize, size_t offset, size_t count) override
 
void Write (const byte *pBuffer, size_t bufferSize, size_t offset, size_t count) override
 
void Flush (void) override
 
std::vector< byte > ToArray (void)
 
- Public Member Functions inherited from Arp::Base::Commons::Io::Stream
 Stream (bool canRead=false, bool canWrite=false, bool canSeek=false)
 This constructor is used to constructs a base stream instance. More...
 
 Stream (const Stream &arg)
 Default copy constructor. More...
 
 Stream (Stream &&arg) noexcept
 Default move constructor. More...
 
Streamoperator= (const Stream &arg)
 Default copy-assignment operator. More...
 
Streamoperator= (Stream &&arg) noexcept
 Default move-assignment operator. More...
 
virtual ~Stream (void)
 Default destructor.
 
virtual bool CanRead (void)
 Determines if the derived stream can read. More...
 
virtual bool CanWrite (void)
 Determines if the derived stream can write. More...
 
virtual bool CanSeek (void)
 Determines if the derived stream can seek. More...
 
virtual void SetPosition (size_t value)
 Sets the position of the stream, if it can seek. More...
 
virtual size_t GetPosition (void)
 Gets the position of the stream, if it can seek. More...
 
virtual size_t Seek (size_t offset, SeekOrigin origin)=0
 
virtual size_t Read (byte *pBuffer, size_t bufferSize, size_t bufferOffset, size_t count)=0
 
virtual void Write (const byte *pBuffer, size_t bufferSize, size_t bufferOffset, size_t count)=0
 
virtual void Flush (void)=0
 
virtual byte ReadByte (void)
 Reads a single byte from the stream. More...
 
virtual void WriteByte (byte value)
 Writes a single byte to the stream. More...
 
virtual void WriteTo (Stream &other)
 Writes the data this stream to another stream entirely. More...
 
virtual void ReadFrom (Stream &other)
 Reads the entire data from another stream into this stream. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Arp::Base::Commons::Io::Stream
static StreamGetEmpty (void)
 Gets an empty stream. More...
 

Constructor & Destructor Documentation

◆ MemoryStream() [1/6]

Arp::System::Commons::Io::MemoryStream::MemoryStream ( size_t  capacity)
explicit

Initializes a new instance of the T:System.IO.MemoryStream class with an expandable capacity initialized as specified.

Parameters
capacityThe initial size of the internal array in bytes.
Exceptions
T:System.ArgumentOutOfRangeExceptioncapacity is negative.

◆ MemoryStream() [2/6]

Arp::System::Commons::Io::MemoryStream::MemoryStream ( byte *  buffer,
size_t  bufferSize 
)

Initializes a new non-resizable instance of the T:System.IO.MemoryStream class based on the specified byte array.

Parameters
bufferThe array of unsigned bytes from which to create the current stream.
Exceptions
T:System.ArgumentNullExceptionbuffer is null.

◆ MemoryStream() [3/6]

Arp::System::Commons::Io::MemoryStream::MemoryStream ( byte *  buffer,
size_t  bufferSize,
boolean  writable 
)

Initializes a new non-resizable instance of the T:System.IO.MemoryStream class based on the specified byte array with the P:System.IO.MemoryStream.CanWrite property set as specified.

Parameters
bufferThe array of unsigned bytes from which to create this stream.
writableThe setting of the P:System.IO.MemoryStream.CanWrite property, which determines whether the stream supports writing.
Exceptions
T:System.ArgumentNullExceptionbuffer is null.

◆ MemoryStream() [4/6]

Arp::System::Commons::Io::MemoryStream::MemoryStream ( byte *  buffer,
size_t  bufferSize,
size_t  index,
size_t  count 
)

Initializes a new non-resizable instance of the T:System.IO.MemoryStream class based on the specified region (index) of a byte array.

Parameters
countThe length of the stream in bytes.
bufferThe array of unsigned bytes from which to create this stream.
indexThe index into buffer at which the stream begins.
Exceptions
T:System.ArgumentNullExceptionbuffer is null.
T:System.ArgumentOutOfRangeExceptionindex or count is less than zero.
T:System.ArgumentExceptionThe sum of index and count is greater than the length of buffer.

◆ MemoryStream() [5/6]

Arp::System::Commons::Io::MemoryStream::MemoryStream ( byte *  buffer,
size_t  bufferSize,
size_t  index,
size_t  count,
boolean  writable 
)

Initializes a new non-resizable instance of the T:System.IO.MemoryStream class based on the specified region of a byte array, with the P:System.IO.MemoryStream.CanWrite property set as specified.

Parameters
countThe length of the stream in bytes.
bufferThe array of unsigned bytes from which to create this stream.
writableThe setting of the P:System.IO.MemoryStream.CanWrite property, which determines whether the stream supports writing.
indexThe index in buffer at which the stream begins.
Exceptions
T:System.ArgumentExceptionThe sum of index and count is greater than the length of buffer.
T:System.ArgumentNullExceptionbuffer is null.
T:System.ArgumentOutOfRangeExceptionindex or count are negative.

◆ MemoryStream() [6/6]

Arp::System::Commons::Io::MemoryStream::MemoryStream ( byte *  buffer,
size_t  bufferSize,
size_t  index,
size_t  count,
boolean  writable,
boolean  publiclyVisible 
)

Initializes a new instance of the T:System.IO.MemoryStream class based on the specified region of a byte array, with the P:System.IO.MemoryStream.CanWrite property set as specified, and the ability to call M:System.IO.MemoryStream.GetBuffer set as specified.

Parameters
countThe length of the stream in bytes.
bufferThe array of unsigned bytes from which to create this stream.
writableThe setting of the P:System.IO.MemoryStream.CanWrite property, which determines whether the stream supports writing.
publiclyVisibletrue to enable M:System.IO.MemoryStream.GetBuffer, which returns the unsigned byte array from which the stream was created; otherwise, false.
indexThe index into buffer at which the stream begins.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex or count is negative.
T:System.ArgumentExceptionThe buffer length minus index is less than count.
T:System.ArgumentNullExceptionbuffer is null.

Member Function Documentation

◆ Flush()

void Arp::System::Commons::Io::MemoryStream::Flush ( void  )
overridevirtual

◆ GetPosition()

size_t Arp::System::Commons::Io::MemoryStream::GetPosition ( void  )
overridevirtual

Gets the position of the stream, if it can seek.

Parameters
valueThe current position of the stream.
Exceptions
NotSupportedExceptionIf this stream cannot seek.

Reimplemented from Arp::Base::Commons::Io::Stream.

◆ Read()

size_t Arp::System::Commons::Io::MemoryStream::Read ( byte *  pBuffer,
size_t  bufferSize,
size_t  offset,
size_t  count 
)
overridevirtual

◆ SetPosition()

void Arp::System::Commons::Io::MemoryStream::SetPosition ( size_t  value)
overridevirtual

Sets the position of the stream, if it can seek.

Parameters
valueThe new position of the stream.
Exceptions
NotSupportedExceptionIf this stream cannot seek.

Reimplemented from Arp::Base::Commons::Io::Stream.

◆ Write()

void Arp::System::Commons::Io::MemoryStream::Write ( const byte *  pBuffer,
size_t  bufferSize,
size_t  offset,
size_t  count 
)
overridevirtual

The documentation for this class was generated from the following files: