MemoryStream
Overview
Stream implementation that stores data in memory
Location
- Reference:
- Elements.dll .NET, .NET Core 6.0, .NET Standard 2.0
- elements.jar Cooper
- Elements.fx Island, ToffeeV2
- libElements.fx Toffee
- Namespace: RemObjects.Elements.RTL
- Ancestry:
- Stream | WrappedPlatformStream | MemoryStream .NET, .NET Core 6.0, .NET Standard 2.0, Island
- Stream | MemoryStream Cooper, Toffee, ToffeeV2
- Stream | WrappedPlatformStream | MemoryStream .NET, .NET Core 6.0, .NET Standard 2.0, Island
constructorMemoryStream()init()MemoryStream()Sub New()constructor(aCapacity: Int32)MemoryStream(Int32 aCapacity)init(_ aCapacity: Int32)MemoryStream(Integer aCapacity)Sub New(aCapacity As Int32)Parameters:
- aCapacity:
constructor(aStream: PlatformStream)MemoryStream(PlatformStream aStream)init(_ aStream: PlatformStream)Sub New(aStream As PlatformStream)Parameters:
- aStream:
constructor(aValue: array of Byte)MemoryStream(Byte[] aValue)init(_ aValue: Byte...)MemoryStream(Byte[] aValue)Sub New(aValue As Byte())Parameters:
- aValue:
constructor(aValue: array of Byte; aCanWrite: Boolean)MemoryStream(Byte[] aValue, Boolean aCanWrite)init( aValue: Byte..., aCanWrite: Boolean)MemoryStream(Byte[] aValue, Boolean aCanWrite)Sub New(aValue As Byte(), aCanWrite As Boolean)Parameters:
- aValue:
- aCanWrite:
constructor(aValue: ImmutableBinary)MemoryStream(ImmutableBinary aValue)init(_ aValue: ImmutableBinary)MemoryStream(ImmutableBinary aValue)Sub New(aValue As ImmutableBinary)Parameters:
- aValue:
Gets access to the underlying storage; does not create a copy, so the byte array could exceed the size of the stream.
property Bytes: array of Byte read;Byte[] Bytes { get; }var Bytes: Byte... { get{} }Byte[] Bytes { __get; }ReadOnly Property Bytes() As Byte()Returns true.
property CanRead: Boolean read;Boolean CanRead { get; }var CanRead: Boolean { get{} }Boolean CanRead { __get; }ReadOnly Property CanRead() As BooleanReturns true.
property CanSeek: Boolean read;Boolean CanSeek { get; }var CanSeek: Boolean { get{} }Boolean CanSeek { __get; }ReadOnly Property CanSeek() As BooleanReturns true.
property CanWrite: Boolean read;Boolean CanWrite { get; }var CanWrite: Boolean { get{} }Boolean CanWrite { __get; }ReadOnly Property CanWrite() As BooleanRemoves all data from this stream and resets the length to 0.
method Clearvoid Clear()func Clear()void Clear()Sub Clear()Close the stream and all resources attached to it.
method Closevoid Close()func Close()void Close()Sub Close()Copy the content of this stream to another
method CopyTo(Destination: Stream)void CopyTo(Stream Destination)func CopyTo(_ Destination: Stream)void CopyTo(Stream Destination)Sub CopyTo(Destination As Stream)Parameters:
- Destination:
Close the stream and underlying resources.
method Disposevoid Dispose()func Dispose()Sub Dispose()Do nothing.
method Flushvoid Flush()func Flush()void Flush()Sub Flush()Returns the length of this stream.
method GetLength: Int64Int64 GetLength()func GetLength() -> Int64Function GetLength() As Int64Returns the current position in this stream.
method GetPosition: Int64Int64 GetPosition()func GetPosition() -> Int64Function GetPosition() As Int64Returns the size of this stream.
var Length: Int64 { get{} }Int64 Length { __get; }Returns the current position.
var Position: Int64 { get{} set{} }Int64 Position { get; set; }Read from this stream. Returns the nr of bytes retreived., or 0 when the end has been reached.
method Read(Buffer: array of Byte; Count: Int32): Int32Int32 Read(Byte[] Buffer, Int32 Count)func Read( Buffer: Byte..., Count: Int32) -> Int32Integer Read(Byte[] Buffer, Integer Count)Function Read(Buffer As Byte(), Count As Int32) As Int32Parameters:
- Buffer:
- Count:
Read from this stream. Returns the nr of bytes retreived, or 0 when the end has been reached.
func Read( Buffer: Byte..., Offset: Int32, _ Count: Int32) -> Int32Integer Read(Byte[] Buffer, Integer Offset, Integer Count)Parameters:
- Buffer:
- Offset:
- Count:
Reads a byte or returns -1 if the stream has reached the end
method ReadByte: Int32Int32 ReadByte()func ReadByte() -> Int32Integer ReadByte()Function ReadByte() As Int32method ReadByte(out aResult: Byte): BooleanBoolean ReadByte(out Byte aResult)func ReadByte(_ aResult: inout Byte) -> BooleanBoolean ReadByte(__out Byte aResult)Function ReadByte(<OutAttribute> ByRef aResult As Byte) As BooleanParameters:
- aResult:
method ReadGuid(out aResult: Guid): BooleanBoolean ReadGuid(out Guid aResult)func ReadGuid(_ aResult: inout Guid) -> BooleanBoolean ReadGuid(__out Guid aResult)Function ReadGuid(<OutAttribute> ByRef aResult As Guid) As BooleanParameters:
- aResult:
method ReadUInt16BE(out aResult: UInt16): BooleanBoolean ReadUInt16BE(out UInt16 aResult)func ReadUInt16BE(_ aResult: inout UInt16) -> BooleanBoolean ReadUInt16BE(__out Word aResult)Function ReadUInt16BE(<OutAttribute> ByRef aResult As UInt16) As BooleanParameters:
- aResult:
method ReadUInt16LE(out aResult: UInt16): BooleanBoolean ReadUInt16LE(out UInt16 aResult)func ReadUInt16LE(_ aResult: inout UInt16) -> BooleanBoolean ReadUInt16LE(__out Word aResult)Function ReadUInt16LE(<OutAttribute> ByRef aResult As UInt16) As BooleanParameters:
- aResult:
method ReadUInt32BE(out aResult: UInt32): BooleanBoolean ReadUInt32BE(out UInt32 aResult)func ReadUInt32BE(_ aResult: inout UInt32) -> BooleanBoolean ReadUInt32BE(__out Cardinal aResult)Function ReadUInt32BE(<OutAttribute> ByRef aResult As UInt32) As BooleanParameters:
- aResult:
method ReadUInt32LE(out aResult: UInt32): BooleanBoolean ReadUInt32LE(out UInt32 aResult)func ReadUInt32LE(_ aResult: inout UInt32) -> BooleanBoolean ReadUInt32LE(__out Cardinal aResult)Function ReadUInt32LE(<OutAttribute> ByRef aResult As UInt32) As BooleanParameters:
- aResult:
method ReadUInt64BE(out aResult: UInt64): BooleanBoolean ReadUInt64BE(out UInt64 aResult)func ReadUInt64BE(_ aResult: inout UInt64) -> BooleanBoolean ReadUInt64BE(__out UInt64 aResult)Function ReadUInt64BE(<OutAttribute> ByRef aResult As UInt64) As BooleanParameters:
- aResult:
method ReadUInt64LE(out aResult: UInt64): BooleanBoolean ReadUInt64LE(out UInt64 aResult)func ReadUInt64LE(_ aResult: inout UInt64) -> BooleanBoolean ReadUInt64LE(__out UInt64 aResult)Function ReadUInt64LE(<OutAttribute> ByRef aResult As UInt64) As BooleanParameters:
- aResult:
this method can be used to change the position of the stream, relative to the current position, start or end of the stream. Returns the new position.
func Seek( Offset: Int64, Origin: SeekOrigin) -> Int64Int64 Seek(Int64 Offset, SeekOrigin Origin)Parameters:
- Offset:
- Origin:
Change the length of this stream.
func SetLength(_ Value: Int64)void SetLength(Int64 Value)Parameters:
- Value:
Sets the absolute position in the stream.
method SetPosition(Value: Int64)void SetPosition(Int64 Value)func SetPosition(_ Value: Int64)Sub SetPosition(Value As Int64)Parameters:
- Value:
Copies the data into an array and returns it.
method ToArray: array of ByteByte[] ToArray()func ToArray() -> Byte...Byte[] ToArray()Function ToArray() As Byte()method Write(Buffer: array of Byte): Int32Int32 Write(Byte[] Buffer)func Write(_ Buffer: Byte...) -> Int32Integer Write(Byte[] Buffer)Function Write(Buffer As Byte()) As Int32Parameters:
- Buffer:
Writes data to the stream.
method Write(Buffer: array of Byte; Count: Int32): Int32Int32 Write(Byte[] Buffer, Int32 Count)func Write( Buffer: Byte..., Count: Int32) -> Int32Integer Write(Byte[] Buffer, Integer Count)Function Write(Buffer As Byte(), Count As Int32) As Int32Parameters:
- Buffer:
- Count:
Writes data to the stream.
func Write( Buffer: Byte..., Offset: Int32, _ Count: Int32) -> Int32Integer Write(Byte[] Buffer, Integer Offset, Integer Count)Parameters:
- Buffer:
- Offset:
- Count:
Writes data to the stream.
method WriteByte(aValue: Byte)void WriteByte(Byte aValue)func WriteByte(_ aValue: Byte)void WriteByte(Byte aValue)Sub WriteByte(aValue As Byte)Parameters:
- aValue:
method WriteGuid(value: Guid): BooleanBoolean WriteGuid(Guid value)func WriteGuid(_ value: Guid) -> BooleanBoolean WriteGuid(Guid value)Function WriteGuid(value As Guid) As BooleanParameters:
- value:
Copy this stream to another stream.
method WriteTo(Destination: Stream)void WriteTo(Stream Destination)func WriteTo(_ Destination: Stream)void WriteTo(Stream Destination)Sub WriteTo(Destination As Stream)Parameters:
- Destination:
method WriteUInt16BE(value: UInt16): BooleanBoolean WriteUInt16BE(UInt16 value)func WriteUInt16BE(_ value: UInt16) -> BooleanBoolean WriteUInt16BE(Word value)Function WriteUInt16BE(value As UInt16) As BooleanParameters:
- value:
method WriteUInt16LE(value: UInt16): BooleanBoolean WriteUInt16LE(UInt16 value)func WriteUInt16LE(_ value: UInt16) -> BooleanBoolean WriteUInt16LE(Word value)Function WriteUInt16LE(value As UInt16) As BooleanParameters:
- value:
method WriteUInt32BE(value: UInt32): BooleanBoolean WriteUInt32BE(UInt32 value)func WriteUInt32BE(_ value: UInt32) -> BooleanBoolean WriteUInt32BE(Cardinal value)Function WriteUInt32BE(value As UInt32) As BooleanParameters:
- value:
method WriteUInt32LE(value: UInt32): BooleanBoolean WriteUInt32LE(UInt32 value)func WriteUInt32LE(_ value: UInt32) -> BooleanBoolean WriteUInt32LE(Cardinal value)Function WriteUInt32LE(value As UInt32) As BooleanParameters:
- value:
method WriteUInt64BE(value: UInt64): BooleanBoolean WriteUInt64BE(UInt64 value)func WriteUInt64BE(_ value: UInt64) -> BooleanBoolean WriteUInt64BE(UInt64 value)Function WriteUInt64BE(value As UInt64) As BooleanParameters:
- value:
method WriteUInt64LE(value: UInt64): BooleanBoolean WriteUInt64LE(UInt64 value)func WriteUInt64LE(_ value: UInt64) -> BooleanBoolean WriteUInt64LE(UInt64 value)Function WriteUInt64LE(value As UInt64) As BooleanParameters:
- value:
Gets access to the underlying storage; does not create a copy, so the byte array could exceed the size of the stream.
property Bytes: array of Byte read;Byte[] Bytes { get; }var Bytes: Byte... { get{} }Byte[] Bytes { __get; }ReadOnly Property Bytes() As Byte()Returns true.
property CanRead: Boolean read;Boolean CanRead { get; }var CanRead: Boolean { get{} }Boolean CanRead { __get; }ReadOnly Property CanRead() As BooleanReturns true.
property CanSeek: Boolean read;Boolean CanSeek { get; }var CanSeek: Boolean { get{} }Boolean CanSeek { __get; }ReadOnly Property CanSeek() As BooleanReturns true.
property CanWrite: Boolean read;Boolean CanWrite { get; }var CanWrite: Boolean { get{} }Boolean CanWrite { __get; }ReadOnly Property CanWrite() As BooleanReturns the size of this stream.
var Length: Int64 { get{} }Int64 Length { __get; }Returns the current position.
var Position: Int64 { get{} set{} }Int64 Position { get; set; }
constructorMemoryStream()init()MemoryStream()Sub New()constructor(aCapacity: Int32)MemoryStream(Int32 aCapacity)init(_ aCapacity: Int32)MemoryStream(Integer aCapacity)Sub New(aCapacity As Int32)Parameters:
- aCapacity:
constructor(aStream: PlatformStream)MemoryStream(PlatformStream aStream)init(_ aStream: PlatformStream)Sub New(aStream As PlatformStream)Parameters:
- aStream:
constructor(aValue: array of Byte)MemoryStream(Byte[] aValue)init(_ aValue: Byte...)MemoryStream(Byte[] aValue)Sub New(aValue As Byte())Parameters:
- aValue:
constructor(aValue: array of Byte; aCanWrite: Boolean)MemoryStream(Byte[] aValue, Boolean aCanWrite)init( aValue: Byte..., aCanWrite: Boolean)MemoryStream(Byte[] aValue, Boolean aCanWrite)Sub New(aValue As Byte(), aCanWrite As Boolean)Parameters:
- aValue:
- aCanWrite:
constructor(aValue: ImmutableBinary)MemoryStream(ImmutableBinary aValue)init(_ aValue: ImmutableBinary)MemoryStream(ImmutableBinary aValue)Sub New(aValue As ImmutableBinary)Parameters:
- aValue:
Removes all data from this stream and resets the length to 0.
method Clearvoid Clear()func Clear()void Clear()Sub Clear()Close the stream and all resources attached to it.
method Closevoid Close()func Close()void Close()Sub Close()Copy the content of this stream to another
method CopyTo(Destination: Stream)void CopyTo(Stream Destination)func CopyTo(_ Destination: Stream)void CopyTo(Stream Destination)Sub CopyTo(Destination As Stream)Parameters:
- Destination:
Close the stream and underlying resources.
method Disposevoid Dispose()func Dispose()Sub Dispose()Do nothing.
method Flushvoid Flush()func Flush()void Flush()Sub Flush()Returns the length of this stream.
method GetLength: Int64Int64 GetLength()func GetLength() -> Int64Function GetLength() As Int64Returns the current position in this stream.
method GetPosition: Int64Int64 GetPosition()func GetPosition() -> Int64Function GetPosition() As Int64Read from this stream. Returns the nr of bytes retreived., or 0 when the end has been reached.
method Read(Buffer: array of Byte; Count: Int32): Int32Int32 Read(Byte[] Buffer, Int32 Count)func Read( Buffer: Byte..., Count: Int32) -> Int32Integer Read(Byte[] Buffer, Integer Count)Function Read(Buffer As Byte(), Count As Int32) As Int32Parameters:
- Buffer:
- Count:
Read from this stream. Returns the nr of bytes retreived, or 0 when the end has been reached.
func Read( Buffer: Byte..., Offset: Int32, _ Count: Int32) -> Int32Integer Read(Byte[] Buffer, Integer Offset, Integer Count)Parameters:
- Buffer:
- Offset:
- Count:
Reads a byte or returns -1 if the stream has reached the end
method ReadByte: Int32Int32 ReadByte()func ReadByte() -> Int32Integer ReadByte()Function ReadByte() As Int32method ReadByte(out aResult: Byte): BooleanBoolean ReadByte(out Byte aResult)func ReadByte(_ aResult: inout Byte) -> BooleanBoolean ReadByte(__out Byte aResult)Function ReadByte(<OutAttribute> ByRef aResult As Byte) As BooleanParameters:
- aResult:
method ReadGuid(out aResult: Guid): BooleanBoolean ReadGuid(out Guid aResult)func ReadGuid(_ aResult: inout Guid) -> BooleanBoolean ReadGuid(__out Guid aResult)Function ReadGuid(<OutAttribute> ByRef aResult As Guid) As BooleanParameters:
- aResult:
method ReadUInt16BE(out aResult: UInt16): BooleanBoolean ReadUInt16BE(out UInt16 aResult)func ReadUInt16BE(_ aResult: inout UInt16) -> BooleanBoolean ReadUInt16BE(__out Word aResult)Function ReadUInt16BE(<OutAttribute> ByRef aResult As UInt16) As BooleanParameters:
- aResult:
method ReadUInt16LE(out aResult: UInt16): BooleanBoolean ReadUInt16LE(out UInt16 aResult)func ReadUInt16LE(_ aResult: inout UInt16) -> BooleanBoolean ReadUInt16LE(__out Word aResult)Function ReadUInt16LE(<OutAttribute> ByRef aResult As UInt16) As BooleanParameters:
- aResult:
method ReadUInt32BE(out aResult: UInt32): BooleanBoolean ReadUInt32BE(out UInt32 aResult)func ReadUInt32BE(_ aResult: inout UInt32) -> BooleanBoolean ReadUInt32BE(__out Cardinal aResult)Function ReadUInt32BE(<OutAttribute> ByRef aResult As UInt32) As BooleanParameters:
- aResult:
method ReadUInt32LE(out aResult: UInt32): BooleanBoolean ReadUInt32LE(out UInt32 aResult)func ReadUInt32LE(_ aResult: inout UInt32) -> BooleanBoolean ReadUInt32LE(__out Cardinal aResult)Function ReadUInt32LE(<OutAttribute> ByRef aResult As UInt32) As BooleanParameters:
- aResult:
method ReadUInt64BE(out aResult: UInt64): BooleanBoolean ReadUInt64BE(out UInt64 aResult)func ReadUInt64BE(_ aResult: inout UInt64) -> BooleanBoolean ReadUInt64BE(__out UInt64 aResult)Function ReadUInt64BE(<OutAttribute> ByRef aResult As UInt64) As BooleanParameters:
- aResult:
method ReadUInt64LE(out aResult: UInt64): BooleanBoolean ReadUInt64LE(out UInt64 aResult)func ReadUInt64LE(_ aResult: inout UInt64) -> BooleanBoolean ReadUInt64LE(__out UInt64 aResult)Function ReadUInt64LE(<OutAttribute> ByRef aResult As UInt64) As BooleanParameters:
- aResult:
this method can be used to change the position of the stream, relative to the current position, start or end of the stream. Returns the new position.
func Seek( Offset: Int64, Origin: SeekOrigin) -> Int64Int64 Seek(Int64 Offset, SeekOrigin Origin)Parameters:
- Offset:
- Origin:
Change the length of this stream.
func SetLength(_ Value: Int64)void SetLength(Int64 Value)Parameters:
- Value:
Sets the absolute position in the stream.
method SetPosition(Value: Int64)void SetPosition(Int64 Value)func SetPosition(_ Value: Int64)Sub SetPosition(Value As Int64)Parameters:
- Value:
Copies the data into an array and returns it.
method ToArray: array of ByteByte[] ToArray()func ToArray() -> Byte...Byte[] ToArray()Function ToArray() As Byte()method Write(Buffer: array of Byte): Int32Int32 Write(Byte[] Buffer)func Write(_ Buffer: Byte...) -> Int32Integer Write(Byte[] Buffer)Function Write(Buffer As Byte()) As Int32Parameters:
- Buffer:
Writes data to the stream.
method Write(Buffer: array of Byte; Count: Int32): Int32Int32 Write(Byte[] Buffer, Int32 Count)func Write( Buffer: Byte..., Count: Int32) -> Int32Integer Write(Byte[] Buffer, Integer Count)Function Write(Buffer As Byte(), Count As Int32) As Int32Parameters:
- Buffer:
- Count:
Writes data to the stream.
func Write( Buffer: Byte..., Offset: Int32, _ Count: Int32) -> Int32Integer Write(Byte[] Buffer, Integer Offset, Integer Count)Parameters:
- Buffer:
- Offset:
- Count:
Writes data to the stream.
method WriteByte(aValue: Byte)void WriteByte(Byte aValue)func WriteByte(_ aValue: Byte)void WriteByte(Byte aValue)Sub WriteByte(aValue As Byte)Parameters:
- aValue:
method WriteGuid(value: Guid): BooleanBoolean WriteGuid(Guid value)func WriteGuid(_ value: Guid) -> BooleanBoolean WriteGuid(Guid value)Function WriteGuid(value As Guid) As BooleanParameters:
- value:
Copy this stream to another stream.
method WriteTo(Destination: Stream)void WriteTo(Stream Destination)func WriteTo(_ Destination: Stream)void WriteTo(Stream Destination)Sub WriteTo(Destination As Stream)Parameters:
- Destination:
method WriteUInt16BE(value: UInt16): BooleanBoolean WriteUInt16BE(UInt16 value)func WriteUInt16BE(_ value: UInt16) -> BooleanBoolean WriteUInt16BE(Word value)Function WriteUInt16BE(value As UInt16) As BooleanParameters:
- value:
method WriteUInt16LE(value: UInt16): BooleanBoolean WriteUInt16LE(UInt16 value)func WriteUInt16LE(_ value: UInt16) -> BooleanBoolean WriteUInt16LE(Word value)Function WriteUInt16LE(value As UInt16) As BooleanParameters:
- value:
method WriteUInt32BE(value: UInt32): BooleanBoolean WriteUInt32BE(UInt32 value)func WriteUInt32BE(_ value: UInt32) -> BooleanBoolean WriteUInt32BE(Cardinal value)Function WriteUInt32BE(value As UInt32) As BooleanParameters:
- value:
method WriteUInt32LE(value: UInt32): BooleanBoolean WriteUInt32LE(UInt32 value)func WriteUInt32LE(_ value: UInt32) -> BooleanBoolean WriteUInt32LE(Cardinal value)Function WriteUInt32LE(value As UInt32) As BooleanParameters:
- value:
method WriteUInt64BE(value: UInt64): BooleanBoolean WriteUInt64BE(UInt64 value)func WriteUInt64BE(_ value: UInt64) -> BooleanBoolean WriteUInt64BE(UInt64 value)Function WriteUInt64BE(value As UInt64) As BooleanParameters:
- value:
method WriteUInt64LE(value: UInt64): BooleanBoolean WriteUInt64LE(UInt64 value)func WriteUInt64LE(_ value: UInt64) -> BooleanBoolean WriteUInt64LE(UInt64 value)Function WriteUInt64LE(value As UInt64) As BooleanParameters:
- value: