Platforms to show: All Mac Windows Linux Cross-Platform

Back to RAMStreamMBS class.

RAMStreamMBS.close

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The destructor.

There is no need to call this method except you want to free all resources of this object now without waiting for Xojo to do it for you.

RamStreamMBS.Constructor(InitialSize as Integer=0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin 7.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new RAMStream.
Example
dim r as RAMStreamMBS
r=new RAMStreamMBS(1000000)
r.write "Hello"

To avoid memory fragmentation the memory grows in 32 KByte chunks.

The parameter you give is the size for the first allocation. So if you only need 2 KByte, you just pass 2048. If you don't know the size, you can pass 0 or a negative number to get the default initial size which is 32 KByte.

You can change the GrowSize property to use a different growing size.
Performance is better if resizing the memory buffer is minimized.

The stream can grow to around 2 GB.
On low memory, the initial resize will fail and length will be 0.

RamStreamMBS.Look(count as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin 3.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads bytes, but does not move the current position.
Example
dim r as RamStreamMBS // your stream
dim s as string
s=r.look(100)

Like the lookahead property in a socket.

RAMStreamMBS.LookBlock(count as Integer) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads bytes into a memoryblock, but leaves the current position untouched.
Example
dim b as RAMStreamMBS
dim s as memoryblock
'...
s=b.LookBlock(5)

RamStreamMBS.LookByte as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin 3.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads a byte, but leaves the current position untouched.

RamStreamMBS.LookLong as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin 3.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads an integer, but leaves the current position untouched.

RamStreamMBS.LookShort as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin 3.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads a short, but leaves the current position untouched.

RAMStreamMBS.Read(count as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads bytes into a string.
Example
dim b as RAMStreamMBS
dim s as string
'...
s=b.read(5)

RAMStreamMBS.ReadBlock(count as Integer) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads bytes into a memoryblock.
Example
dim b as RAMStreamMBS
dim s as memoryblock
'...
s=b.ReadBlock(5)

RAMStreamMBS.Readbyte as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads an 8bit Byte from the stream.
Example
dim b as RAMStreamMBS
dim i as Integer
'...
i=B.readbyte

RAMStreamMBS.ReadLong as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads a signed 32bit Integer from the stream.
Example
dim b as RAMStreamMBS
dim i as Integer
'...
i=B.readlong

This function is affected by the LittleEndian Setting.

RAMStreamMBS.ReadShort as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads a signed 16bit Integer from the stream.
Example
dim b as RAMStreamMBS
dim i as Integer
'...
i=B.readshort

This function is affected by the LittleEndian Setting.

RAMStreamMBS.Write(data as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes bytes from a string to file.

RAMStreamMBS.WriteBlock(data as memoryblock,count as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes count bytes from a memoryblock to file.
Example
dim b as RAMStreamMBS
dim m as memoryblock
'...
b.writeblock m,m.size

RAMStreamMBS.WriteByte(data as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a byte to file.

RAMStreamMBS.WriteLong(data as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes an 32bit integer to file.

This method is affected by the LittleEndian Setting.

RAMStreamMBS.WriteShort(data as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method RAMStream MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes an 16bit integer to file.

This method is affected by the LittleEndian Setting.

The items on this page are in the following plugins: MBS Util Plugin.


The biggest plugin in space...