API for handling input and output files through memory or other non-standard I/O devices. Supported on: Windows, Linux, MacOS.
More...
|
#define | NOT_APPLICATION_STREAM ((size_t)-1) |
| Return this value if the given name is not handled by your stream callbacks.
|
|
API for handling input and output files through memory or other non-standard I/O devices. Supported on: Windows, Linux, MacOS.
◆ R_IOStreamfuncs
◆ kRecSetIOStreamCB()
IOStream.
This function sets the application callback API for streaming IO.
- Parameters
-
[in] | iosCB | Pointer to the R_IOStreamfuncs structure containing callback functions. Must be provided and implemented by the application. Use NULL to turn off the callback mechanism. |
- Note
- After the IOStream API has been set, all CSDK file opens are hooked and the callback R_IOStreamfuncs::ropen_stream is called first. You must invent a naming convention that you use to tell normal files and your streams apart (for example start all your stream names like "mystream:"). If the actual name belongs to the application (i.e. it fits your naming convention),
ropen_stream
must return a unique ID in streamID. Otherwise you must return NOT_APPLICATION_STREAM
in the streamID
parameter and the file will be handled normally.
Your generated stream ID will be passed to your other callbacks. You can map these IDs to handler objects inside your application to perform the required operation.
Return errno
compatible error code when your stream operation has an error.
-
See Sample71.cpp for a sample implementation of the usage of the IOStream API on RECAPI.
-
For .NET application Objects API sample #71 (Samples\CSClassSamples\Sample71.cs) contains a worked out sample solution.
-
In .NET both
FileStream
and MemoryStream
are directly supported as well as byte[]
objects. These standard streams can be set using IOStreamCB.SetStream("userStreamName", Stream or byte[])
Any other non standard IO has to be completely implemented in the callbacks by the application.
-
The specification of this function in Java is:
RECERR RECAPIKRN kRecSetIOStreamCB(R_IOStreamfuncs *iosCB)
IOStream.
-
The specification of this function in Python is: