[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LDataStream



Description:

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:

 

LDataStream()  
~LDataStream()  
GetBuffer()  
SetBuffer()  
GetBytes()  
PutBytes()  
operator =  
 

Data Members:

There one data members in this class:

 

mBuffer  
 

Source files:

(File & Stream Classes)

LDataStream.h

LDataStream.cp

See also:

LStream

LDataStream()

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 :

Public

Prototypes:

LDataStream(); // Default Constructor

LDataStream( const LDataStream& inOriginal );

LDataStream( void* inBuffer,
  SInt32 inLength);
Return:

No return value for a constructor.

Remarks:

Just calls the inherited methods.

~LDataStream()

Purpose:

The destructor closes the data and resource forks before deletion.

Access :

Public, Virtual

Prototype:

virtual ~LDataStream();
Parameters:

None

Return:

No return value for a destructor

GetBuffer()

Purpose:

Return a pointer to the entire DataStream.

Access :

Public, Virtual

Prototype:

void* GetBuffer()
Parameters:

None

Return:

mBuffer.

Remarks:

This method is actually found in LDataStream.h.

SetBuffer()

Purpose:

Set the stream buffer (mBuffer) to inBuffer and the length of the stream to inLength.

Access :

Public, Virtual

Prototype:

void SetBuffer(
  void* inBuffer,
  SInt32 inLength);
Parameters:

 

void*  
inBuffer  
Pointer to the DataStream.  
SInt32  
inLength  
size of stream in bytes to write  

Return:

None

GetBytes()

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 :

Public, Virtual

Prototype:

ExceptionCode GetBytes(
  void* outBuffer,
  SInt32& ioByteCount);
Parameters:

 

void*  
outBuffer  
Pointer to the data buffer  
SInt32&  
ioByteCount  
Number of bytes to read  

Return:

readErr if attempt to read past the end of the DataStream. Otherwise, returns noErr.

PutBytes()

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 :

Public, Virtual

Prototype:

ExceptionCode PutBytes(
  const void* inBuffer,
  SInt32& ioByteCount);
Parameters:

 

void*  
inBuffer  
Pointer to the data buffer  
SInt32&  
ioByteCount  
Number of bytes to write  

Return:

Write if attempt to read past the end of the DataStream. Otherwise, returns noErr.

operator =

Purpose:

Assignment operator. The DataStream will point to the same buffer as the original.

Access :

Public

Prototype:

LDataStream&		operator = (
  const LDataStream& inOriginal);
Parameters:

 

const LDataStream&  
inOriginal  
Address of the original DataStream  

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.

mBuffer

Purpose:

Pointer to the data buffer.

Access:

Protected

Prototype:

void* mBuffer

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000