libx3d io -- The I/O handling in the X3D libraries
Version 0.1 In order to handle any type of input and output (especially input though), the libx3d system comes with an I/O interface.
It is expected that several implementation be available to load virtually anything such as:
The interface is written in such a way that it can be used to encapsulate other streams. For instance, the HTTP server could be sending us a JPEG image compressed using bz2 to save a few bytes. In such a case, opening the HTTP stream will automatically create a decompressor and return a stream pointer which can do both: read over the network and decompress the data.
- regular files (i.e.
FILE * -- implemented, see the FileStream)
- compressed files (i.e. filename.x3d.gz)
- files on an HTTP server
- files on an FTP server
- files read over a network using some other protocol (i.e. local socket)
- bufferized files (for network file to be saved in memory or a local cache)
In most cases, you will:
To write to a file, use the x3dio::Stream::Create(), x3dio::Stream::Update() or x3dio::Stream::Append() functions instead. Just like with x3dio::Stream::Open() the stream is automatically closed on destruction of the stream.
- FileStream supports an additional function called x3dio::FileStream::Attach() used to attach an existing stream (such as
stdout) to a stream.
- Alexis Wilke