Vault  4.1
Public Member Functions
VReadOnlyMemoryStream Class Reference

VReadOnlyMemoryStream is a convenience class that lets you share a single buffer between multiple memory streams. More...

#include <vmemorystream.h>

Inheritance diagram for VReadOnlyMemoryStream:
VMemoryStream VStream

List of all members.

Public Member Functions

 VReadOnlyMemoryStream (Vu8 *buffer, Vs64 suppliedEOFOffset)
 Constructs the object with an existing buffer.
 VReadOnlyMemoryStream (const VReadOnlyMemoryStream &other)
 Copy constructor.
virtual ~VReadOnlyMemoryStream ()
 Destructor.
VReadOnlyMemoryStreamoperator= (const VReadOnlyMemoryStream &other)
 Assignment operator.
void adoptBuffer (Vu8 *buffer, BufferAllocationType allocationType, Vs64 suppliedBufferSize, Vs64 suppliedEOFOffset)
 Makes the object use a specified buffer instead of the one it is currently using.
virtual Vs64 write (const Vu8 *buffer, Vs64 numBytesToWrite)
 Throws a VEOFException because this class is a read-only stream.
virtual void flush ()
 Throws a VEOFException because this class is a read-only stream.

Detailed Description

VReadOnlyMemoryStream is a convenience class that lets you share a single buffer between multiple memory streams.

To do this, you can instantiate multiple VReadOnlyMemoryStream objects, supplying them all the same buffer. They will all prevent writing (throwing an exception for any write method), and will not "own" the buffer and so will not delete/free it. The various streams can be independently used to seek and read the stream without affecting the point of view of other readers. This facility even allows you to supply a pointer to a location inside an arbitrary actual buffer (heap or stack) because the VReadOnlyMemoryStream object will never use the pointer for memory managment purposes such as delete or free.

Definition at line 278 of file vmemorystream.h.


Constructor & Destructor Documentation

VReadOnlyMemoryStream::VReadOnlyMemoryStream ( Vu8 buffer,
Vs64  suppliedEOFOffset 
)

Constructs the object with an existing buffer.

Parameters:
bufferthe buffer that the VMemoryStream will work on
suppliedEOFOffsetthe offset of the end of the "valid" data in the supplied buffer

Definition at line 495 of file vmemorystream.cpp.


Member Function Documentation

void VReadOnlyMemoryStream::adoptBuffer ( Vu8 buffer,
BufferAllocationType  allocationType,
Vs64  suppliedBufferSize,
Vs64  suppliedEOFOffset 
)

Makes the object use a specified buffer instead of the one it is currently using.

The existing buffer will be deleted/freed if the existing buffer is owned by the VMemoryStream.

Parameters:
bufferthe buffer that the VMemoryStream will work on
allocationTypehow the buffer was allocated, so that VMemoryStream knows the proper way to reallocate it and to delete/free it
suppliedBufferSizethe size of the supplied buffer
suppliedEOFOffsetthe offset of the end of the "valid" data in the supplied buffer

Definition at line 508 of file vmemorystream.cpp.


The documentation for this class was generated from the following files:

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.