Xojo.IO.BinaryStream
From Xojo Documentation
Class (inherits from Object)
The BinaryStream class is an input/output mechanism for reading and writing arbitrary binary data. It can be used with MemoryBlocks and FolderItems.
Properties | ||||
|
Enumerations | |
|
Constructors | |
|
Shared Methods | |||
|
Notes
The Read/Write methods raise an exception when reading or writing past the end of the stream. File IO prevents thread switching.
Sample Code
Load an image that is copied to an iOS app using a Copy Files Build Step:
Var f As FolderItem = SpecialFolder.GetResource("MyImage.JPG")
Var b As BinaryStream
b = BinaryStream.Open(f, BinaryStream.LockModes.Read)
Var mb As New MemoryBlock(b.Read(b.Length))
b.Close
Var image As iOSImage
image = Image.FromData(mb)
ImageView1.Image = image
Var b As BinaryStream
b = BinaryStream.Open(f, BinaryStream.LockModes.Read)
Var mb As New MemoryBlock(b.Read(b.Length))
b.Close
Var image As iOSImage
image = Image.FromData(mb)
ImageView1.Image = image
See Also
Xojo.IO.FolderItem, Xojo.Core.MemoryBlock classes