Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

RAMStreamMBS.close
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: The destructor.
Notes:
There is no need to call this method except you want to free all resources of this object now without waiting for Realbasic to do it for you.
(e.g. some Realbasic versions crash on Windows if there are plugin objects not closed.)

Feedback, Comments & Corrections

RamStreamMBS.Constructor(InitialSize as Integer=0)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin 7.4 Yes Yes Yes Yes No
Function: Creates a new RAMStream.
Example:
dim r as RAMStreamMBS
r=new RAMStreamMBS(1000000)
r.write "Hello"
Notes:
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.

Feedback, Comments & Corrections

CreateRamStreamMBS(InitialSize as Integer = 0) as RamStreamMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Creates a new RAMStream.
Example:
dim r as RAMStreamMBS
r=CreateRamStreamMBS(1000000)
r.write "Hello"
Notes:
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.
Returns nil on low memory.

Some examples using this method:

Feedback, Comments & Corrections

RamStreamMBS.Look(count as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin 3.4 Yes Yes Yes Yes No
Function: Reads bytes, but does not move the current position.
Example:
dim r as RamStreamMBS // your stream
dim s as string
s=r.look(100)
Notes: Like the lookahead property in a socket.

Feedback, Comments & Corrections

RAMStreamMBS.LookBlock(count as Integer) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Reads bytes into a memoryblock, but leaves the current position untouched.
Example:
dim b as RAMStreamMBS
dim s as memoryblock
'...
s=b.LookBlock(5)

Feedback, Comments & Corrections

RamStreamMBS.LookByte as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin 3.4 Yes Yes Yes Yes No
Function: Reads a byte, but leaves the current position untouched.

Feedback, Comments & Corrections

RamStreamMBS.LookLong as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin 3.4 Yes Yes Yes Yes No
Function: Reads an integer, but leaves the current position untouched.

Feedback, Comments & Corrections

RamStreamMBS.LookShort as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin 3.4 Yes Yes Yes Yes No
Function: Reads a short, but leaves the current position untouched.

Feedback, Comments & Corrections

RAMStreamMBS.Read(count as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Reads bytes into a string.
Example:
dim b as RAMStreamMBS
dim s as string
'...
s=b.read(5)

Feedback, Comments & Corrections

RAMStreamMBS.ReadBlock(count as Integer) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Reads bytes into a memoryblock.
Example:
dim b as RAMStreamMBS
dim s as memoryblock
'...
s=b.ReadBlock(5)

Feedback, Comments & Corrections

RAMStreamMBS.Readbyte as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Reads an 8bit Byte from the stream.
Example:
dim b as RAMStreamMBS
dim i as Integer
'...
i=B.readbyte

Feedback, Comments & Corrections

RAMStreamMBS.ReadLong as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Reads a signed 32bit Integer from the stream.
Example:
dim b as RAMStreamMBS
dim i as Integer
'...
i=B.readlong
Notes: This function is affected by the LittleEndian Setting.

Feedback, Comments & Corrections

RAMStreamMBS.ReadShort as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Reads a signed 16bit Integer from the stream.
Example:
dim b as RAMStreamMBS
dim i as Integer
'...
i=B.readshort
Notes: This function is affected by the LittleEndian Setting.

Feedback, Comments & Corrections

RAMStreamMBS.Write(data as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Writes bytes from a string to file.

Feedback, Comments & Corrections

RAMStreamMBS.WriteBlock(data as memoryblock,count as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Writes count bytes from a memoryblock to file.
Example:
dim b as RAMStreamMBS
dim m as memoryblock
'...
b.writeblock m,m.size

Feedback, Comments & Corrections

RAMStreamMBS.WriteByte(data as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Writes a byte to file.

Feedback, Comments & Corrections

RAMStreamMBS.WriteLong(data as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Writes an 32bit integer to file.
Notes: This method is affected by the LittleEndian Setting.

Feedback, Comments & Corrections

RAMStreamMBS.WriteShort(data as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method RAMStream MBS Util Plugin Yes Yes Yes Yes No
Function: Writes an 16bit integer to file.
Notes: This method is affected by the LittleEndian Setting.

Feedback, Comments & Corrections

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




Links
MBS FileMaker Plugins