LDataStream is a stream whose bytes are maintained in a block of memory delimited by a pointer to the first byte and a byte count.
This class supports reading and writing of bytes from or to the stream in arbitrary size blocks.
Methods :
The methods in this class are:
Data Members:
There one data members in this class:
Source files:
See also:
Purpose:
There are three constructor methods.
The default constructor sets mBuffer to nil. The second constructor is this class' copy constructor.
The third constructor creates the LDataStream object from a pointer
and a byte count. inBuffer points to the first byte of the stream, which is inLength bytes long.
Access :
Prototypes:
LDataStream(); // Default Constructor
LDataStream( const LDataStream& inOriginal );
LDataStream( void* inBuffer,
SInt32 inLength); No return value for a constructor.
Remarks:
Just calls the inherited methods.
Purpose:
The destructor closes the data and resource forks before deletion.
Access :
Prototype:
virtual ~LDataStream();Parameters:
Return:
No return value for a destructor
Purpose:
Return a pointer to the entire DataStream.
Access :
Prototype:
void* GetBuffer()Parameters:
Return:
Remarks:
This method is actually found in LDataStream.h.
Purpose:
Set the stream buffer (mBuffer) to inBuffer and the length of the stream to inLength.
Access :
Prototype:
void SetBuffer(
void* inBuffer, SInt32 inLength); Return:
Purpose:
Reads data from the DataStream to a buffer. Passes back the number of bytes actually read which may be less than the amount requested.
Access :
Prototype:
ExceptionCode GetBytes(
void* outBuffer, SInt32& ioByteCount); Return:
readErr if attempt to read past the end of the DataStream. Otherwise,
returns noErr.
Purpose:
Writes data from a buffer to the DataStream. Passes back the number of bytes actually written which may be less than the amount requested.
Access :
Prototype:
ExceptionCode PutBytes(
const void* inBuffer, SInt32& ioByteCount); Return:
Write if attempt to read past the end of the DataStream. Otherwise,
returns noErr.
Purpose:
Assignment operator. The DataStream will point to the same buffer as the original.
Access :
Prototype:
LDataStream& operator = (
const LDataStream& inOriginal); Return:
Address of the DataStream object.
Remarks:
operator = does not create a duplicate of the DataStream, but assigns a DataStream the same memory address as the original. If you delete one, you loose both. You have been warned.
Purpose:
Access:
Prototype:
void* mBuffer