BinaryStreams with different storage backings!
In previous versions of REALbasic, a BinaryStream represented one thing only -- a file on disk. Now you can back a BinaryStream with a MemoryBlock, or a string. This is really handy when you want to construct a MemoryBlock, but don't want to mess around with keeping track of positions.
[rbcode]
// Make a 0-length memory block
dim mb as new MemoryBlock( 0 )
// And back a BinaryStream with it
dim bs as new BinaryStream( mb )
// Write some data to the stream
bs.WriteLong( 12 )
bs.WriteShort( 456 )
// Close our stream down
bs.Close
MsgBox Str( mb.Size ) // Will show 6
MsgBox Str( mb.Short( 2 ) ) // Will show 456
[/rbcode]
This sort of thing is really handy when you want to construct packets that you send out over a socket or serial device.
Huh. I'd forgotten all about that feature.