RShareBuf Class Reference

#include <s32share.h>

class RShareBuf : public MStreamBuf

Inherits from

Public Member Functions
RShareBuf()
IMPORT_C voidOpen(TStreamExchange &, TStreamPos, TInt)
voidOpen(TStreamExchange &, TInt)
Protected Member Functions
virtual IMPORT_C TIntDoReadL(TAny *, TInt)
virtual IMPORT_C TIntDoReadL(TDes8 &, TInt, TRequestStatus &)
virtual IMPORT_C TStreamTransferDoReadL(MStreamInput &, TStreamTransfer)
virtual IMPORT_C voidDoRelease()
virtual IMPORT_C TStreamPosDoSeekL(TMark, TStreamLocation, TInt)
virtual IMPORT_C voidDoWriteL(const TAny *, TInt)
virtual IMPORT_C TIntDoWriteL(const TDesC8 &, TInt, TRequestStatus &)
virtual IMPORT_C TStreamTransferDoWriteL(MStreamOutput &, TStreamTransfer)
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

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.

See also: TStreamMark TStreamExchange RFileBuf RShareReadStream RShareWriteStream

Constructor & Destructor Documentation

RShareBuf ( )

IMPORT_CRShareBuf()

Constructs an empty shared stream buffer object.

Call one of the Open() functions to prepare the stream.

Member Function Documentation

DoReadL ( TAny *, TInt )

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

Reimplemented from MStreamBuf::DoReadL(TAny *,TInt)

DoReadL ( TDes8 &, TInt, TRequestStatus & )

IMPORT_C TIntDoReadL(TDes8 &aDes,
TIntaMaxLength,
TRequestStatus &aStatus
)[protected, virtual]

Reads data from the stream buffer into the specified descriptor.

This function is called by 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 DoReadL(TAny*,TInt) variant.

See also: MStreamBuf::ReadL()

ParameterDescription
aDesThe 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.
aMaxLengthThe 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.
aStatusThe request status that indicates the completion status of this asynchronous request.

Returns: 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.

DoReadL ( MStreamInput &, TStreamTransfer )

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

Reads data from the stream into the specified data sink.

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

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

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

See also: MStreamInput::ReadFromL()

ParameterDescription
anInputThe target data sink.
aTransferA stream transfer object defining the amount of data available to be read.

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

DoRelease ( )

IMPORT_C voidDoRelease()[protected, virtual]

Reimplemented from MStreamBuf::DoRelease()

Frees resources before abandoning the stream buffer.

It is called by Release().

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

See also: MStreamBuf::Release()

DoSeekL ( TMark, TStreamLocation, TInt )

IMPORT_C TStreamPosDoSeekL(TMarkaMark,
TStreamLocationaLocation,
TIntanOffset
)[protected, virtual]

DoWriteL ( const TAny *, TInt )

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

DoWriteL ( const TDesC8 &, TInt, TRequestStatus & )

IMPORT_C TIntDoWriteL(const TDesC8 &aDes,
TIntaMaxLength,
TRequestStatus &aStatus
)[protected, virtual]

Writes data from the specified descriptor into this stream buffer.

This function is called by 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.

See also: MStreamBuf::WriteL()

ParameterDescription
aDesThe source descriptor for the data to be written into the stream buffer.
aMaxLengthThe 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.
aStatusThe request status that indicates the completion status of this asynchronous request.

Returns: 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.

DoWriteL ( MStreamOutput &, TStreamTransfer )

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

Open ( TStreamExchange &, TStreamPos, TInt )

IMPORT_C voidOpen(TStreamExchange &aHost,
TStreamPosaPos,
TIntaMode = ERead|EWrite
)

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.

See also: MStreamBuf::TRead MStreamBuf::TWrite

ParameterDescription
aHostThe object that manages shared streaming.
aPosThe position within the host stream.
aModeThe streaming mode. This can be read and/or write, as indicated by the ERead and EWrite bits.

Open ( TStreamExchange &, TInt )

voidOpen(TStreamExchange &aHost,
TIntaMode = ERead|EWrite
)[inline]

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.

See also: MStreamBuf::TRead MStreamBuf::TWrite KStreamBeginning

ParameterDescription
aHostThe object that manages shared streaming.
aModeThe streaming mode. This can be read and/or write, as indicated by the ERead and EWrite bits.