BinaryStream.Constructor(Handle as Integer, Type as Integer)
From Xojo Documentation
Creates a BinaryStream from an OS handle.
Type is one of the HandleType class constants and Handle is the appropriate handle type specified by the Type parameter.
The BinaryStream class constants given below can be passed as the parameter.
|HandleTypeWin32Handle||A Windows32 OS handle.|
|HandleTypeFilePointer||A file pointer.|
|HandleTypeFileNumber||A file descriptor.|
|HandleTypeMacFileRefNum||A file reference number. (FSRef type)|
|HandleTypeMacFileSpecPointer||An FSSpec (obsolete on Mac OS X. Use HandleTypeMacFileRefNum instead.)|
For instance, you can use a Declare to open a file with whatever permissions that you wish, and then pass the Handle to a stream object's constructor. When you do this, the BinaryStream now retains the ownership rights to the file handle, so you should not close the file handle (via a declare for example), since it will close when the BinaryStream is destructed.