Location:
s32file.h
Link against: estor.lib
RFileBuf
Supported from 5.0
A stream buffer hosted by a file.
Instances of this class are used by file based persistent stores, i.e. CFileStore
type objects. An RFileBuf
object is associated with a file and the file is said to be attached to the stream buffer.
An RFileBuf
object is also used by RFileReadStream
and RFileWriteStream
objects to provide buffered file I/O.
The stream buffer has intermediate buffering capabilities.
When used as the basis for a file store, it hosts multiple streams through the TStreamExchange
and RShareBuf
classes
|
Defined in RFileBuf
:
Reset()
, Attach()
, Close()
, Create()
, Detach()
, File()
, Open()
, RFileBuf()
, Reattach()
, Replace()
, Reset()
, SetSizeL()
, Temp()
Inherited from MStreamBuf
:
SeekL()
,
DoRelease()
,
DoSeekL()
,
DoSynchL()
,
ERead
,
EWrite
,
PushL()
,
Read()
,
ReadL()
,
Release()
,
SeekL()
,
SizeL()
,
Synch()
,
SynchL()
,
TMark
,
TRead
,
TWrite
,
TellL()
,
Write()
,
WriteL()
Inherited from TStreamBuf
:
Avail()
,
DoReadL()
,
DoWriteL()
,
End()
,
OverflowL()
,
Ptr()
,
SetBuf()
,
SetEnd()
,
SetPtr()
,
TArea
,
UnderflowL()
RFileBuf();
Constructs the object with a default intermediate buffer size.
The size of the intermediate buffer is the value of the constant KDefaultFileBufSize
.
RFileBuf(TInt aSize);
Constructs the object with the specified intermediate buffer size.
|
MStreamBuf
interface to unbuffered file I/O.void Reset();
Frees the intermediate buffer.
If there is any read data in the intermediate buffer, then the function reverts the read position within the stream.
void Reset(TInt aSize);
Frees the intermediate buffer and changes the size of any future intermediate buffer to the specified value.
|
void SetSizeL(TInt aSize);
Changes the size of the file attached to this buffer to the specified value.
Writes any outstanding data from the intermediate buffer to the stream hosted by the file. Any data in the intermediate buffer that would lie beyond the end of the truncated file, is not written.
|
void Attach(RFile& aFile,TInt aPos=0);
Attaches the specified file to this stream buffer.
The function also re-sets the intermediate buffer's read and write marks to the beginning of the intermediate buffer and sets the read and write stream positions to the specified offset within the file.
|
void Detach();
Detaches the file from this stream buffer.
The intermediate buffer's read and write marks are not changed, and the stream positions are not changed. This means that the contents of the file should not change while it is detached.
void Reattach(RFile& aFile);
Re-attaches the specified file to this stream buffer.
The intermediate buffer's read and write marks are not changed, and the stream positions are not changed.
The file should be the one
that was detached using the Detach()
function.
|
TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode);
Opens the specified file and attaches it to this stream buffer.
|
|
TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode);
Creates a file with the specified name and attaches it to this stream buffer.
The file must not already exist.
|
|
TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode);
Replaces the file with the specified name and attaches it to this stream buffer.
If there is an existing file with the same name, then this function overwrites it. If the file does not already exist, it is created.
|
|
TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode);
Creates and opens a temporary file with a unique name and attaches it to this stream buffer.
|
RFile& File() const;
Gets a reference to the file attached to this stream buffer.
|
void Close();
Writes any outstanding data from the intermediate buffer before freeing the intermediate buffer and closing the attached file.
RFileBuf(TCapture<RFileBuf> aCapture);
This is internal and is not intended for use.
|