Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <S32SHARE.H>
Link against: estor.lib

Class RShareBuf

class RShareBuf : public MStreamBuf;

Description

A shared stream buffer.

This class is part of the framework used by CFileStore that allows multiple stream buffers to concurrently access the single hosting file buffer, an RFileBuf object.

Each shared stream buffer maintains its own read and write positions.

Read and write operations to RShareBuf are directed through separate TStreamMark objects, one for read and one for write. The TStreamMark objects re-direct read/write operations through a TStreamExchange object to the RFileBuf object, which handles the actual file read and write operations.

This stream buffer can also be accessed through RShareReadStream and RShareWriteStream objects.

Derivation

Members

Defined in RShareBuf:

Inherited from MStreamBuf:

See also:


Construction and destruction


RShareBuf()

IMPORT_C RShareBuf();

Description

Constructs an empty shared stream buffer object.

Call one of the RShareBuf::Open(TStreamExchange &,TStreamPos,TInt) functions to prepare the stream.

[Top]


Member functions


Open(TStreamExchange &,TStreamPos,TInt)

IMPORT_C void Open(TStreamExchange &aHost, TStreamPos aPos, TInt aMode=ERead|EWrite);

Description

Prepares the shared stream buffer for streaming.

The function sets the read mark and/or the write mark to the specified position within the host stream.

Parameters

TStreamExchange &aHost

The object that manages shared streaming.

TStreamPos aPos

The position within the host stream.

TInt aMode

The streaming mode. This can be read and/or write, as indicated by the ERead and EWrite bits.

See also:


Open(TStreamExchange &,TInt)

inline void Open(TStreamExchange &aHost, TInt aMode=ERead|EWrite);

Description

Prepares the shared stream buffer for streaming.

The function sets the read mark and/or the write mark to the beginning of the host stream.

Parameters

TStreamExchange &aHost

The object that manages shared streaming.

TInt aMode

The streaming mode. This can be read and/or write, as indicated by the ERead and EWrite bits.

See also:


DoRelease()

protected: IMPORT_C virtual void DoRelease();

Description

Frees resources before abandoning the stream buffer.

It is called by MStreamBuf::Release().

This implementation is empty, but classes derived from MStreamBuf can provide their own implementation, if necessary.

See also:


DoReadL(TAny *,TInt)

protected: IMPORT_C virtual TInt DoReadL(TAny *aPtr, TInt aMaxLength);

Description

Parameters

TAny *aPtr

TInt aMaxLength

Return value

TInt


DoReadL(TDes8 &,TInt,TRequestStatus &)

protected: IMPORT_C virtual TInt DoReadL(TDes8 &aDes, TInt aMaxLength, TRequestStatus &aStatus);

Description

Reads data from the stream buffer into the specified descriptor.

This function is called by MStreamBuf::ReadL(TDes8 &,TInt,TRequestStatus &).

This implementation deals with the request synchronously, and completes the request with KErrNone. Other implementations may choose to deal with this in a true asynchronous manner.

In addition, the read operation itself uses the RShareBuf::DoReadL(TAny *,TInt) variant.

Parameters

TDes8 &aDes

The target descriptor for the data read from the stream buffer. On return, the length of the descriptor is set to the number of bytes read from the stream buffer.

TInt aMaxLength

The maximum number of bytes to be read. This value must not be greater than the maximum length of the descriptor, otherwise the function raises a STORE-Stream 2 panic.

TRequestStatus &aStatus

The request status that indicates the completion status of this asynchronous request.

Return value

TInt

The maximum number of bytes to be read, as used in this request. This implementation uses, and returns, the value supplied in aMaxLength. Other implementations may choose to use a different value.

See also:


DoReadL(MStreamInput &,TStreamTransfer)

protected: IMPORT_C virtual TStreamTransfer DoReadL(MStreamInput &anInput, TStreamTransfer aTransfer);

Description

Reads data from the stream into the specified data sink.

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

This implementation calls the sink's ReadFromL() function, which performs the read (transfer) operation.

This implementation of RShareBuf::DoReadL(TAny *,TInt) is called for streams that do not have buffering capabilities, and that are derived directly from this class.

Parameters

MStreamInput &anInput

The target data sink.

TStreamTransfer aTransfer

A stream transfer object defining the amount of data available to be read.

Return value

TStreamTransfer

A stream transfer object defining the amount of data that was not consumed.

See also:


DoWriteL(const TAny *,TInt)

protected: IMPORT_C virtual void DoWriteL(const TAny *aPtr, TInt aLength);

Description

Parameters

const TAny *aPtr

TInt aLength


DoWriteL(const TDesC8 &,TInt,TRequestStatus &)

protected: IMPORT_C virtual TInt DoWriteL(const TDesC8 &aDes, TInt aMaxLength, TRequestStatus &aStatus);

Description

Writes data from the specified descriptor into this stream buffer.

This function is called by MStreamBuf::WriteL(const TDesC8 &,TInt,TRequestStatus &).

This implementation deals with the request synchronously, and completes the request with KErrNone. Other implementations may choose to deal with this in a true asynchronous manner.

In addition, the write operation itself uses the DoWriteL(TAny*,TInt) variant.

Parameters

const TDesC8 &aDes

The source descriptor for the data to be written into the stream buffer.

TInt aMaxLength

The number of bytes to be written. This value must not be greater than the maximum length of the descriptor, otherwise the function raises a STORE-Stream 6 panic.

TRequestStatus &aStatus

The request status that indicates the completion status of this asynchronous request.

Return value

TInt

The maximum number of bytes to be written, as used in this request. This implementation uses, and returns, the value supplied in aMaxLength. Other implementations may choose to use a different value.

See also:


DoWriteL(MStreamOutput &,TStreamTransfer)

protected: IMPORT_C virtual TStreamTransfer DoWriteL(MStreamOutput &anOutput, TStreamTransfer aTransfer);

Description

Parameters

MStreamOutput &anOutput

TStreamTransfer aTransfer

Return value

TStreamTransfer


DoSeekL(TMark,TStreamLocation,TInt)

protected: IMPORT_C virtual TStreamPos DoSeekL(TMark aMark, TStreamLocation aLocation, TInt anOffset);

Description

Parameters

MStreamBuf::TMark aMark

TStreamLocation aLocation

TInt anOffset

Return value

TStreamPos