TStreamBuf Class Reference

#include <s32buf.h>

class TStreamBuf : public MStreamBuf

Inherits from

Protected Member Type Definitions
typedef TInt TArea
Protected Member Functions
TStreamBuf()
IMPORT_C TIntAvail(TArea)
TInt Avail(TRead)
TInt Avail(TWrite)
virtual IMPORT_C TIntDoReadL(TAny *, TInt)
virtual IMPORT_C TStreamTransferDoReadL(MStreamInput &, TStreamTransfer)
virtual IMPORT_C voidDoWriteL(const TAny *, TInt)
virtual IMPORT_C TStreamTransferDoWriteL(MStreamOutput &, TStreamTransfer)
IMPORT_C TUint8 *End(TArea)
TUint8 *End(TRead)
TUint8 *End(TWrite)
IMPORT_C TUint8 *Ptr(TArea)
TUint8 *Ptr(TRead)
TUint8 *Ptr(TWrite)
IMPORT_C voidSetBuf(TArea, TUint8 *, TUint8 *)
voidSetBuf(TRead, TUint8 *, TUint8 *)
voidSetBuf(TWrite, TUint8 *, TUint8 *)
IMPORT_C voidSetEnd(TArea, TUint8 *)
voidSetEnd(TRead, TUint8 *)
voidSetEnd(TWrite, TUint8 *)
IMPORT_C voidSetPtr(TArea, TUint8 *)
voidSetPtr(TRead, TUint8 *)
voidSetPtr(TWrite, TUint8 *)
Inherited Enumerations
MStreamBuf:TRead
MStreamBuf:TWrite
Inherited Functions
MStreamBuf::Close()
MStreamBuf::MStreamBuf()
MStreamBuf::PushL()
MStreamBuf::Read(TDes8 &,TInt,TRequestStatus &)
MStreamBuf::Read(TDes8 &,TRequestStatus &)
MStreamBuf::ReadL(MStreamInput &)
MStreamBuf::ReadL(MStreamInput &,TInt)
MStreamBuf::ReadL(MStreamInput &,TStreamTransfer)
MStreamBuf::ReadL(TAny *,TInt)
MStreamBuf::ReadL(TDes8 &,TInt,TRequestStatus &)
MStreamBuf::ReadL(TDes8 &,TRequestStatus &)
MStreamBuf::Release()
MStreamBuf::SeekL(TMark,TStreamLocation,TInt)
MStreamBuf::SeekL(TMark,TStreamPos)
MStreamBuf::SeekL(TRead,TInt)
MStreamBuf::SeekL(TRead,TStreamLocation,TInt)
MStreamBuf::SeekL(TWrite,TInt)
MStreamBuf::SeekL(TWrite,TStreamLocation,TInt)
MStreamBuf::SizeL()const
MStreamBuf::Synch()
MStreamBuf::SynchL()
MStreamBuf::TellL(TRead)const
MStreamBuf::TellL(TWrite)const
MStreamBuf::Write(const TDesC8 &,TInt,TRequestStatus &)
MStreamBuf::Write(const TDesC8 &,TRequestStatus &)
MStreamBuf::WriteL(MStreamOutput &)
MStreamBuf::WriteL(MStreamOutput &,TInt)
MStreamBuf::WriteL(MStreamOutput &,TStreamTransfer)
MStreamBuf::WriteL(const TAny *,TInt)
MStreamBuf::WriteL(const TDesC8 &,TInt,TRequestStatus &)
MStreamBuf::WriteL(const TDesC8 &,TRequestStatus &)
Inherited Type Definitions
MStreamBuf::TMark

Detailed Description

Adds buffering capabilities to a stream buffer

The class provides pointers to mark out the current read and write areas within the intermediate buffer. The class also defines the pure virtual functions UnderflowL() and OverflowL() which must be provided by a derived class.

Streams which have buffering capabilities derive from this class, otherwise they derive from MStreamBuf.

Note that the class does not provide the buffer; this is left to the class derived from it. For example, the memory buffer classes use the memory area directly, the file buffer class allocate a heap cell to use as a buffer.

See also: UnderflowL() OverflowL()

Member Type Definition Documentation

Typedef TArea

typedef TInt TArea[protected]

Used to identify the type of area within an intermediate buffer.

The type is used by functions of this class that set or get pointers into the intermediate buffer.

The type uses the ERead and EWrite enumeration values, as bit flags, to identify the read and write areas respectively.

ERead is an MStreamBuf::TRead enumerator. EWrite is an MStreamBuf::EWrite enumerator.

See also: MStreamBuf::TRead MStreamBuf::TWrite

Constructor & Destructor Documentation

TStreamBuf ( )

IMPORT_CTStreamBuf()[protected]

Sets the pointers that mark out the read and write areas within the intermediate buffer to null.

Member Function Documentation

Avail ( TArea )

IMPORT_C TIntAvail(TAreaanArea)const [protected]

Gets the number of bytes available in the read or write area within the intermediate buffer.

Parameters
anAreaThe area within the intermediate buffer for which the number of available bytes is to be fetched. This can be either the read area or the write area, as indicated by the ERead and EWrite bits. Only one of these can be set, otherwise the function raises a STORE-Stream 17 panic.
Return Value
The number of bytes available.

Avail ( TRead )

TInt Avail(TRead)const [protected, inline]

Gets the number of bytes available in the read area within the intermediate buffer.

See also: MStreamBuf::TRead

Return Value
The number of bytes available.

Avail ( TWrite )

TInt Avail(TWrite)const [protected, inline]

Gets the number of bytes available in the write area within the intermediate buffer.

See also: MStreamBuf::TWrite

Return Value
The number of bytes available.

DoReadL ( TAny *, TInt )

IMPORT_C TIntDoReadL(TAny *aPtr,
TIntaMaxLength
)[protected, virtual]

Reads data from the intermediate buffer into the specified memory location.

The function calls the virtual function UnderfLowL() to give concrete implementations the chance to refill the intermediate buffer, and satisfy the caller's requirements.

This implementation overrides the one supplied by the base class MStreamBuf, and is called by, MStreamBuf::ReadL(TAny*,TInt).

See also: MStreamBuf::ReadL() MStreamBuf::DoReadL()

Parameters
aPtrA pointer to the target memory location for the data read from the intermediate buffer.
aMaxLengthThe maximum number of bytes to be read.
Return Value
The number of bytes read. This may be less than the amount requested.

DoReadL ( MStreamInput &, TStreamTransfer )

IMPORT_C TStreamTransferDoReadL(MStreamInput &anInput,
TStreamTransferaTransfer
)[protected, virtual]

Reads data from the intermediate buffer and, if necessary, any remaining data from the stream to the specified target stream input object.

It is called by ReadL(MStreamInput&,TStreamTransfer).

The intermediate buffer is emptied first by calling the target stream input's PushL() function, which performs the read from intermediate buffer operation. Any remaining data is then read from the stream by calling the target stream object's ReadFromL() function, which performs the read from stream operation.

This implementation is called for streams that have buffering capabilities and are derived from this class.

See also: MStreamInput::ReadFromL() MStreamInput::PushL()

Parameters
anInputThe target stream input object.
aTransferA stream transfer object defining the amount of data available to be written.
Return Value
The amount of data that was not consumed.

DoWriteL ( const TAny *, TInt )

IMPORT_C voidDoWriteL(const TAny *aPtr,
TIntaLength
)[protected, virtual]

Writes data from the specified memory location into the intermediate buffer.

The function calls the virtual function OverfLowL() to give concrete implementations the chance to forward the intermediate buffer content to its destination.

This implementation overrides the one supplied by the base class MStreamBuf, and is called by MStreamBuf::WriteL(const TAny*,TInt).

See also: MStreamBuf::WriteL() MStreamBuf::DoWriteL()

Parameters
aPtrA pointer to the source memory location for the data to be written to the intermediate buffer.
aLengthThe number of bytes to be written.
Return Value
The number of bytes written.

DoWriteL ( MStreamOutput &, TStreamTransfer )

IMPORT_C TStreamTransferDoWriteL(MStreamOutput &anOutput,
TStreamTransferaTransfer
)[protected, virtual]

End ( TArea )

IMPORT_C TUint8 *End(TAreaanArea)const [protected]

Gets the current end point of the read or write area within the intermediate buffer.

An end point is always the first byte beyond the end of an area.

Parameters
anAreaThe area within the intermediate buffer for which the end point is to be fetched. This can be either the read area or the write area, as indicated by the ERead and EWrite bits. Only one of these can be set, otherwise the function raises a STORE-Stream 17 panic.
Return Value
The end point.

End ( TRead )

TUint8 *End(TRead)const [protected, inline]

Gets the current end point of the read area within the intermediate buffer.

An end point is always the first byte beyond the end of an area.

See also: MStreamBuf::TRead

Return Value
The end point.

End ( TWrite )

TUint8 *End(TWrite)const [protected, inline]

Gets the current end point of the write area within the intermediate buffer.

An end point is always the first byte beyond the end of an area.

See also: MStreamBuf::TWrite

Return Value
The end point.

Ptr ( TArea )

IMPORT_C TUint8 *Ptr(TAreaanArea)const [protected]

Gets the current start point of the read or write area within the intermediate buffer.

See also: MStreamBuf::TRead MStreamBuf::TWrite

Parameters
anAreaThe area within the intermediate buffer for which the start point is to be fetched. This can be either the read area or the write area, as indicated by the ERead and EWrite bits. Only one of these can be set, otherwise the function raises a STORE-Stream 17 panic.
Return Value
The start point.

Ptr ( TRead )

TUint8 *Ptr(TRead)const [protected, inline]

Gets the current start point of the read area within the intermediate buffer.

See also: MStreamBuf::TRead

Return Value
The start point.

Ptr ( TWrite )

TUint8 *Ptr(TWrite)const [protected, inline]

Gets the current start point of the write area within the intermediate buffer.

See also: MStreamBuf::TWrite

Return Value
The start point.

SetBuf ( TArea, TUint8 *, TUint8 * )

IMPORT_C voidSetBuf(TAreaanArea,
TUint8 *aPtr,
TUint8 *anEnd
)[protected]

Sets the start and end points of the read and/or the write area within the intermediate buffer.

A start point is always within an area; an end point is always the first byte beyond the end of an area.

See also: MStreamBuf::TRead MStreamBuf::TWrite

Parameters
anAreaThe areas within the intermediate buffer for which the start and end points are to be set. These can be the read area and/or the write area, as indicated by the ERead and EWrite bits. Only these bits can be set, otherwise the function raises a STORE-Stream 17 panic.
aPtrThe start point.
anEndThe end point.

SetBuf ( TRead, TUint8 *, TUint8 * )

voidSetBuf(TRead,
TUint8 *aPtr,
TUint8 *anEnd
)[protected, inline]

Sets the start and end points of the read area within the intermediate buffer.

A start point is always within an area; an end point is always the first byte beyond the end of an area.

See also: MStreamBuf::TRead

Parameters
aPtrThe start point.
anEndThe end point.

SetBuf ( TWrite, TUint8 *, TUint8 * )

voidSetBuf(TWrite,
TUint8 *aPtr,
TUint8 *anEnd
)[protected, inline]

Sets the start and end points of the write area within the intermediate buffer.

A start point is always within an area; an end point is always the first byte beyond the end of an area.

See also: MStreamBuf::TWrite

Parameters
aPtrThe start point.
anEndThe end point.

SetEnd ( TArea, TUint8 * )

IMPORT_C voidSetEnd(TAreaanArea,
TUint8 *anEnd
)[protected]

SetEnd ( TRead, TUint8 * )

voidSetEnd(TRead,
TUint8 *anEnd
)[protected, inline]

SetEnd ( TWrite, TUint8 * )

voidSetEnd(TWrite,
TUint8 *anEnd
)[protected, inline]

SetPtr ( TArea, TUint8 * )

IMPORT_C voidSetPtr(TAreaanArea,
TUint8 *aPtr
)[protected]

Sets the start point of the read and/or the write area within the intermediate buffer.

A start point is always within an area.

See also: MStreamBuf::TRead MStreamBuf::TWrite

Parameters
anAreaThe areas within the intermediate buffer for which the start point is to be set. These can be the read area and/or the write area, as indicated by the ERead and EWrite bits. Only these bits can be set, otherwise the function raises a STORE-Stream 17 panic.
aPtrThe start point.

SetPtr ( TRead, TUint8 * )

voidSetPtr(TRead,
TUint8 *aPtr
)[protected, inline]

Sets the start point of the write area within the intermediate buffer.

A start point is always within an area.

See also: MStreamBuf::TWrite

Parameters
aPtrThe start point.

SetPtr ( TWrite, TUint8 * )

voidSetPtr(TWrite,
TUint8 *aPtr
)[protected, inline]

Sets the start point of the write area within the intermediate buffer.

A start point is always within an area.

See also: MStreamBuf::TWrite

Parameters
aPtrThe start point.