The OEOpenIStream
and OEOpenOStream
functions create and
return the appropriate oestream
for handling the specified parameter.
These functions take one parameter which is initially parsed to determine
whether or not a colon delimited protocol is present to indicate how the
I/O should be handled. If no protocol is specified, the parameter is assumed
to correspond to a filename. If a protocol is specified, the function checks
to see whether an appropriate stream allocator and deallocator has been
registered to handle this protocol. If the protocol has been registered, an
appropriate stream will be created and returned, otherwise, the function will
return 0. Allocators and deallocators are registered using the
OEPlatform::OERegisterStream
functions. All oestreams
created
with these functions, must be closed using the corresponding
OECloseStream
function. Finally, file names, as well as input data, are
analyzed to determine if they are compressed. If the file name or data suggests
compression, the returned stream will be appropriately setup to dynamically
handle the compression requirements.
oeistream *is = OEOpenIStream("file: input.txt.gz"); oeostream *os = OEOpenOStream("file: output.txt.gz"); if (is && *is && os && *os) *os << *is << oeflush; OECloseIStream(is); OECloseOStream(os);