Xojo.IO.BinaryStream.Read

From Xojo Documentation

Method

Xojo.IO.BinaryStream.Read(count As Integer) As Xojo.Core.MemoryBlock

Supported for all project types and targets.

Reads the specified number of bytes. Raises an exception if the file is not readable.

Sample Code

Read 1K into a MemoryBlock:

Var data As MemoryBlock
data = bStream.Read(1024)

Read the entire file into a MemoryBlock:

Var data As MemoryBlock
data = bStream.Read(bStream.Length)