A concrete implementation of StreamFactory that instantiates MemoryInputStreams for a fixed collection of DataViews.
More...
#include <bond/io/memorystreamfactory.h>
A concrete implementation of StreamFactory that instantiates MemoryInputStreams for a fixed collection of DataViews.
A file name is looked up by exact match against the names in the DataViewIndex. The factory cannot create output streams itself, so it always forwards CreateOutputStream to its delegate factory.
◆ MemoryStreamFactory()
Constructs a MemoryStreamFactory object.
- Parameters
-
| allocator | The memory allocator from which MemoryInputStreams are allocated. |
| index | The index of DataViews from which MemoryInputStreams are instantiated. The names in the index must be sorted in ascending order, since they are binary searched. The index is not copied and must remain valid for the lifetime of the factory. |
| delegateFactory | If this factory cannot provide a stream, this factory is used as a fallback. May be null. |
| throwOnFailure | If true, stream creation failures are reported by throwing an Exception. Otherwise, stream creation failures return a null handle. |
◆ ~MemoryStreamFactory()
| virtual Bond::MemoryStreamFactory::~MemoryStreamFactory |
( |
| ) |
|
|
inlinevirtual |
◆ CreateInputStream()
| virtual InputStreamHandle Bond::MemoryStreamFactory::CreateInputStream |
( |
const char * | fileName | ) |
|
|
overridevirtual |
◆ CreateOutputStream()
| virtual OutputStreamHandle Bond::MemoryStreamFactory::CreateOutputStream |
( |
const char * | fileName, |
|
|
bool | append ) |
|
overridevirtual |
Returns the stream created by the delegate factory.
- Parameters
-
| fileName | The name of the file for which an output stream is created. |
| append | Whether bytes are written to the end of an existing file. |
Implements Bond::StreamFactory.
◆ SetDelegateFactory()
| void Bond::MemoryStreamFactory::SetDelegateFactory |
( |
StreamFactory * | delegateFactory | ) |
|
|
inline |
Sets the fallback StreamFactory used when this factory cannot provide a stream.
- Parameters
-
The documentation for this class was generated from the following file:
- include/bond/io/memorystreamfactory.h