![Symbian Developer Library](../../../../a_stock/images/mainheading.gif)
![]() |
![]() |
|
class MStreamBuf;
A stream buffer that provides a generic I/O interface for streamed data.
A stream buffer:
may be buffered or unbuffered
may provide read-only, write-only or read/write capability
may be seekable, or unseekable.
A seekable stream buffer maintains independent read and write pointers, which can be manipulated separately. This is unlike
the RFile
interface which maintains a single current position in the file. For example, file streams and memory streams are seekable
streams, but socket, serial-comms, and filtered streams are not.
Objects of this type are used by the stream interface classes derived from RReadStream
and RWriteStream
.
The class has no member data.
Derive from this class, if the stream has no intermediate buffering capabilities, otherwise derive from TStreamBuf
.
Get a reference to the stream buffer used by a read stream by calling RReadStream::Source()
. Get a reference to the stream buffer used by a write stream by calling RWriteStream::Sink()
Defined in MStreamBuf
:
Close()
Closes the stream buffer.DoReadL(MStreamInput &,TStreamTransfer)
Reads data from the stream into the specified data sink.DoReadL(TAny *,TInt)
DoReadL(TDes8 &,TInt,TRequestStatus &)
Reads data from the stream buffer into the specified descriptor.DoRelease()
Frees resources before abandoning the stream buffer.DoSeekL(TMark,TStreamLocation,TInt)
DoSynchL()
Synchronises the stream buffer with the stream, leaving if any error occurs.DoWriteL(MStreamOutput &,TStreamTransfer)
DoWriteL(const TAny *,TInt)
DoWriteL(const TDesC8 &,TInt,TRequestStatus &)
Writes data from the specified descriptor into this stream buffer.ERead
EWrite
MStreamBuf()
PushL()
Puts a cleanup item for this object onto the cleanup stack.Read(TDes8 &,TInt,TRequestStatus &)
Reads data, asynchronously, from the stream buffer into the specified descriptor...Read(TDes8 &,TRequestStatus &)
Reads data, asynchronously, from the stream buffer into the specified descriptor...ReadL(MStreamInput &)
Reads data from the stream buffer into the specified data sink.ReadL(MStreamInput &,TInt)
Reads data from the stream buffer into the specified data sink.ReadL(MStreamInput &,TStreamTransfer)
Reads data from the stream buffer into the specified data sink.ReadL(TAny *,TInt)
Reads data from the stream buffer into the specified memory location.ReadL(TDes8 &,TInt,TRequestStatus &)
Reads data, asynchronously, from the stream buffer into the specified descriptor...ReadL(TDes8 &,TRequestStatus &)
Reads data, asynchronously, from the stream buffer into the specified descriptor...Release()
Frees resources before abandoning the stream buffer.SeekL(TMark,TStreamLocation,TInt)
Moves the position of the read mark or the write mark in the stream.SeekL(TMark,TStreamPos)
Moves the position of the read or write mark in the stream.SeekL(TRead,TInt)
Moves the position of the read mark in the stream by the specified offset.SeekL(TRead,TStreamLocation,TInt)
Moves the position of the read mark in the stream.SeekL(TWrite,TInt)
Moves the position of the write mark in the stream by the specified offset.SeekL(TWrite,TStreamLocation,TInt)
Moves the position of the write mark in the stream.SizeL()const
Gets the size of the stream.Synch()
Synchronises the stream buffer with the stream, returning any error.SynchL()
Synchronises the stream buffer with the stream, leaving if any error occurs.TMark
Used to identify the type of mark in a stream.TRead
Indicates that an operation applies to the read mark in a stream or to the read ...TWrite
Indicates that an operation applies to the write mark in a stream or to the writ...TellL(TRead)const
Gets the position of the read mark within the stream.TellL(TWrite)const
Gets the position of the write mark within the stream.Write(const TDesC8 &,TInt,TRequestStatus &)
Write(const TDesC8 &,TRequestStatus &)
Writes data, asynchronously, from the specified descriptor into the stream buffe...WriteL(MStreamOutput &)
Writes data into the stream buffer from the specified data source.WriteL(MStreamOutput &,TInt)
Writes data into the stream buffer from the specified data source.WriteL(MStreamOutput &,TStreamTransfer)
Writes data into the stream buffer from the specified data source.WriteL(const TAny *,TInt)
Writes data from the specified memory location into the stream buffer.WriteL(const TDesC8 &,TInt,TRequestStatus &)
Writes data, asynchronously, from the specified descriptor into the stream buffe...WriteL(const TDesC8 &,TRequestStatus &)
Writes data, asynchronously, from the specified descriptor into the stream buffe...RReadStream
...RWriteStream
...IMPORT_C void Close();
Closes the stream buffer.
This function attempts to synchronise buffered data with the stream before freeing any resources. All errors are ignored.
MStreamBuf::Synch()
Synchronises the stream buffer with the stream, returning any error.MStreamBuf::Release()
Frees resources before abandoning the stream buffer.inline void Release();
Frees resources before abandoning the stream buffer.
The function calls the virtual function MStreamBuf::DoRelease()
to implement this behaviour.
MStreamBuf::Release()
is called by both RReadStream::Release()
and RWriteStream::Release()
.
MStreamBuf::DoRelease()
Frees resources before abandoning the stream buffer.RReadStream::Release()
Frees resources before abandoning the stream.RWriteStream::Release()
Frees resources before abandoning the stream. The function is called after data ...IMPORT_C TInt Synch();
Synchronises the stream buffer with the stream, returning any error.
In effect, this ensures that buffered data is delivered to the stream.
This function calls MStreamBuf::SynchL()
inside a TRAPD harness and returns the leave code if a leave occurs.
|
MStreamBuf::SynchL()
Synchronises the stream buffer with the stream, leaving if any error occurs.MStreamBuf::DoSynchL()
Synchronises the stream buffer with the stream, leaving if any error occurs.inline void SynchL();
Synchronises the stream buffer with the stream, leaving if any error occurs.
In effect, this ensures that buffered data is delivered to the stream.
The function calls the virtual function MStreamBuf::DoSynchL()
to implement this behaviour.
MStreamBuf::DoSynchL()
Synchronises the stream buffer with the stream, leaving if any error occurs.IMPORT_C void PushL();
Puts a cleanup item for this object onto the cleanup stack.
This allows allocated resources to be cleaned up if a subsequent leave occurs.
inline TInt ReadL(TAny *aPtr, TInt aMaxLength);
Reads data from the stream buffer into the specified memory location.
The function calls the virtual function MStreamBuf::DoReadL(TAny *,TInt)
to implement this behaviour.
|
|
IMPORT_C TInt Read(TDes8 &aDes, TRequestStatus &aStatus);
Reads data, asynchronously, from the stream buffer into the specified descriptor; request completion is guaranteed, even if request initiation fails.
The function calls the virtual function MStreamBuf::DoReadL(TDes8 &,TInt,TRequestStatus &)
to implement this behaviour. The maximum number of bytes to be read is the value of the maximum length of the descriptor.
|
|
IMPORT_C TInt Read(TDes8 &aDes, TInt aMaxLength, TRequestStatus &aStatus);
Reads data, asynchronously, from the stream buffer into the specified descriptor; request completion is guaranteed, even if request initiation fails.
The function calls the virtual function MStreamBuf::DoReadL(TDes8 &,TInt,TRequestStatus &)
to implement this behaviour.
|
|
IMPORT_C TInt ReadL(TDes8 &aDes, TRequestStatus &aStatus);
Reads data, asynchronously, from the stream buffer into the specified descriptor.
The function calls the virtual function MStreamBuf::DoReadL(TDes8 &,TInt,TRequestStatus &)
to implement this behaviour. The maximum number of bytes to be read is the maximum length of the descriptor.
If the function leaves, then no read request will have been initiated.
|
|
inline TInt ReadL(TDes8 &aDes, TInt aMaxLength, TRequestStatus &aStatus);
Reads data, asynchronously, from the stream buffer into the specified descriptor.
The function calls the virtual function MStreamBuf::DoReadL(TDes8 &,TInt,TRequestStatus &)
to implement this behaviour.
If the function leaves, then no read request will have been initiated.
|
|
inline TStreamTransfer ReadL(MStreamInput &anInput, TStreamTransfer aTransfer);
Reads data from the stream buffer into the specified data sink.
The function calls the virtual function MStreamBuf::DoReadL(MStreamInput &,TStreamTransfer)
to implement this behaviour.
|
|
IMPORT_C TInt ReadL(MStreamInput &anInput, TInt aMaxLength);
Reads data from the stream buffer into the specified data sink.
The function uses the virtual function MStreamBuf::DoReadL(MStreamInput &,TStreamTransfer)
to implement this behaviour.
|
|
inline void ReadL(MStreamInput &anInput);
Reads data from the stream buffer into the specified data sink.
The function uses the virtual function MStreamBuf::DoReadL(MStreamInput &,TStreamTransfer)
to implement this behaviour.
No explicit limit is placed on the amount of data that can be read.
|
inline void WriteL(const TAny *aPtr, TInt aLength);
Writes data from the specified memory location into the stream buffer.
The function calls the virtual function DoWriteL(TAny*,TInt) to implement this behaviour.
|
IMPORT_C TInt Write(const TDesC8 &aDes, TRequestStatus &aStatus);
Writes data, asynchronously, from the specified descriptor into the stream buffer; request completion is guaranteed, even if request initiation fails.
The function calls the virtual function MStreamBuf::DoWriteL(const TDesC8 &,TInt,TRequestStatus &)
to implement this behaviour. The maximum number of bytes to be written is the value of the maximum length of the descriptor.
|
|
IMPORT_C TInt Write(const TDesC8 &aDes, TInt aMaxLength, TRequestStatus &aStatus);
|
|
IMPORT_C TInt WriteL(const TDesC8 &aDes, TRequestStatus &aStatus);
Writes data, asynchronously, from the specified descriptor into the stream buffer.
The function calls the virtual function MStreamBuf::DoWriteL(const TDesC8 &,TInt,TRequestStatus &)
to implement this behaviour. The maximum number of bytes to be written is the value of the maximum length of the descriptor.
If the function leaves, then no write request will have been initiated.
|
|
inline TInt WriteL(const TDesC8 &aDes, TInt aMaxLength, TRequestStatus &aStatus);
Writes data, asynchronously, from the specified descriptor into the stream buffer.
The function calls the virtual function MStreamBuf::DoWriteL(const TDesC8 &,TInt,TRequestStatus &)
to implement this behaviour.
If the function leaves, then no write request will have been initiated.
|
|
inline TStreamTransfer WriteL(MStreamOutput &anOutput, TStreamTransfer aTransfer);
Writes data into the stream buffer from the specified data source.
The function calls the virtual function MStreamBuf::DoWriteL(MStreamOutput &,TStreamTransfer)
to implement this behaviour.
|
|
IMPORT_C TInt WriteL(MStreamOutput &anOutput, TInt aMaxLength);
Writes data into the stream buffer from the specified data source.
The function calls the virtual function MStreamBuf::DoWriteL(MStreamOutput &,TStreamTransfer)
to implement this behaviour.
|
|
inline void WriteL(MStreamOutput &anOutput);
Writes data into the stream buffer from the specified data source.
The function calls the virtual function MStreamBuf::DoWriteL(MStreamOutput &,TStreamTransfer)
to implement this behaviour.
No explicit limit is placed on the amount of data that can be written.
|
inline void SeekL(TMark aMark, TStreamPos aPos);
Moves the position of the read or write mark in the stream.
The new position is calculated by adding the specified value to the position of the beginning of the stream.
The function calls virtual function MStreamBuf::DoSeekL(TMark,TStreamLocation,TInt)
to implement this behaviour. Notes: As there are two current positions, one for the read mark and one for the write mark,
it is not valid, in general, to use a single call to MStreamBuf::SeekL(TMark,TStreamPos)
to move both the read and write marks. Not all streams are seekable.
|
inline TStreamPos SeekL(TMark aMark, TStreamLocation aLocation, TInt anOffset=0);
Moves the position of the read mark or the write mark in the stream.
The new position is calculated by adding the specified offset to one of:
the position of the beginning of the stream
the position of the end of the stream
the position of the current read mark or write mark.
The function calls the virtual function MStreamBuf::DoSeekL(TMark,TStreamLocation,TInt)
to implement this behaviour.
As there are two current positions, one for the read mark and one for the write mark, it is not valid, in general, to use
a single call to MStreamBuf::SeekL(TMark,TStreamPos)
to move both the read and write marks.
Not all streams are seekable.
|
|
inline TStreamPos SeekL(TRead, TStreamLocation aLocation, TInt anOffset=0);
Moves the position of the read mark in the stream.
The new position is calculated by adding the specified offset to one of:
the position of the beginning of the stream
the position of the end of the stream
the position of the current read mark.
The function calls the virtual function MStreamBuf::DoSeekL(TMark,TStreamLocation,TInt)
to implement this behaviour.
Not all streams are seekable.
|
|
inline TStreamPos SeekL(TWrite, TStreamLocation aLocation, TInt anOffset=0);
Moves the position of the write mark in the stream.
The new position is calculated by adding the specified offset to one of:
the position of the beginning of the stream
the position of the end of the stream
the position of the current write mark.
The function calls the virtual function MStreamBuf::DoSeekL(TMark,TStreamLocation,TInt)
to implement this behaviour.
Not all streams are seekable.
|
|
inline TStreamPos SeekL(TRead, TInt anOffset);
Moves the position of the read mark in the stream by the specified offset.
The function calls the virtual function MStreamBuf::DoSeekL(TMark,TStreamLocation,TInt)
to implement this behaviour.
Not all streams are seekable.
|
|
inline TStreamPos SeekL(TWrite, TInt anOffset);
Moves the position of the write mark in the stream by the specified offset.
The function calls the virtual function MStreamBuf::DoSeekL(TMark,TStreamLocation,TInt)
to implement this behaviour.
Not all streams are seekable.
|
|
inline TStreamPos TellL(TRead) const;
Gets the position of the read mark within the stream.
The function calls the virtual function MStreamBuf::DoSeekL(TMark,TStreamLocation,TInt)
to implement this behaviour.
|
|
inline TStreamPos TellL(TWrite) const;
Gets the position of the write mark within the stream.
The function calls the virtual function MStreamBuf::DoSeekL(TMark,TStreamLocation,TInt)
to implement this behaviour.
|
|
inline TInt SizeL() const;
Gets the size of the stream.
|
private: IMPORT_C virtual void DoRelease();
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.
MStreamBuf::Release()
Frees resources before abandoning the stream buffer.private: IMPORT_C virtual void DoSynchL();
Synchronises the stream buffer with the stream, leaving if any error occurs.
In effect, this ensures that buffered data is delivered to the stream.
It is called by MStreamBuf::SynchL()
.
This implementation is empty, but classes derived from MStreamBuf can provide their own implementation, if necessary.
MStreamBuf::SynchL()
Synchronises the stream buffer with the stream, leaving if any error occurs.private: IMPORT_C virtual TInt DoReadL(TAny *aPtr, TInt aMaxLength);
|
|
private: IMPORT_C virtual TInt DoReadL(TDes8 &aDes, TInt aMaxLength, TRequestStatus &aStatus);
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 MStreamBuf::DoReadL(TAny *,TInt)
variant.
|
|
MStreamBuf::ReadL(TAny *,TInt)
Reads data from the stream buffer into the specified memory location.private: IMPORT_C virtual TStreamTransfer DoReadL(MStreamInput &anInput, TStreamTransfer aTransfer);
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 MStreamBuf::DoReadL(TAny *,TInt)
is called for streams that do not have buffering capabilities, and that are derived directly from this class.
|
|
MStreamInput::ReadFromL(MStreamBuf &,TStreamTransfer)
Reads data from the specified stream into this stream input object.private: IMPORT_C virtual void DoWriteL(const TAny *aPtr, TInt aLength);
|
private: IMPORT_C virtual TInt DoWriteL(const TDesC8 &aDes, TInt aMaxLength, TRequestStatus &aStatus);
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.
|
|
MStreamBuf::WriteL(const TAny *,TInt)
Writes data from the specified memory location into the stream buffer.private: IMPORT_C virtual TStreamTransfer DoWriteL(MStreamOutput &anOutput, TStreamTransfer aTransfer);
|
|
private: IMPORT_C virtual TStreamPos DoSeekL(TMark aMark, TStreamLocation aLocation, TInt anOffset);
|
|
TRead
Indicates that an operation applies to the read mark in a stream or to the read area in an stream buffer.
|
TWrite
Indicates that an operation applies to the write mark in a stream or to the write area in an stream buffer.
|
typedef TInt MStreamBuf::TMark;
Used to identify the type of mark in a stream.
The type is used by functions of this class and derived classes that perform seek operations to marks within a stream.
The type uses the ERead and EWrite enumeration values, as bit flags, to identify the read and write marks respectively.
ERead is an MStreamBuf::TRead
enumerator. EWrite is an MStreamBuf::EWrite
enumerator.
MStreamBuf::TRead
Indicates that an operation applies to the read mark in a stream or to the read ...MStreamBuf::TWrite
Indicates that an operation applies to the write mark in a stream or to the writ...