BoxedApp SDK Help >> Virtual File System

IStream-based Virtual File

BoxedAppSDK_CreateVirtualFile creates a file with the contents located in the shared memory. This is the easiest way to create a virtual file, which is sufficient for the majority of cases. However, sometimes you may need to have a virtual file with its data stored in other places: database, encrypted file or the Internet. For that purpose, BoxedApp SDK allows creating a virtual file, based on the implementation of the standard interface IStream: BoxedAppSDK_CreateVirtualFileBasedOnIStream.

Reading from such file takes the method IStream::Read(); writing to it calls IStream::Write(). Creating a new handler that points to such file requires IStream::Clone(), which returns IStream with its own current pointer. To set and get the current position in that file, BoxedApp uses IStream::Seek(). To resize the file, it uses IStream::SetSize(). To get the size of the file, it can call the method IStream::Stat():

File operation Method Notes
Reading IStream::Read
Writing IStream::Write
Getting new file handler IStream::Clone Creating a new handler that points to such file requires IStream::Clone(), which returns IStream with its own current pointer
Get current position IStream::Seek
Get file size IStream::Stat The size can be also obtained with IStream::Seek(); BoxedApp can move the pointer to the end of the file (by setting the STREAM_SEEK_END flag and zero offset) and get the new position value. This would be the sought file size. That is why it is important to properly implement the IStream::Seek() method



Copyright © Softanics. All rights reserved.
BoxedApp is a trademark of Softanics.