class RFile : public RSubSessionBase |
Creates and opens a file, and performs all operations on a single open file.
These include:
reading from and writing to the file
seeking to a position within the file
locking and unlocking within the file
setting file attributes
Before using any of these services, a connection to a file server session must have been made, and the file must be open.
Opening Files:
use Create() to create and open a new file for writing; an error is returned if it already exists.
use Replace() to open a file for writing, replacing any existing file of the same name if one exists, or creating a new file if one does not exist. Note that if a file exists, its length is reset to zero.
use Temp() to create and open a temporary file with a unique name, for writing and reading.
When opening a file, you must specify the file server session to use for operations with that file. If you do not close the file explicitly, it is closed when the server session associated with it is closed.
Reading and Writing:
There are several variants of both Read() and Write(). The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented by variants allowing the descriptor length to be overridden, or the seek position of the first byte to be specified, or asynchronous completion, or any combination.
Reading transfers data from a file to a descriptor, and writing transfers data from a descriptor to a file. In all cases, the file data is treated as binary and byte descriptors are used (TDes8, TDesC8).
Public Member Functions | |
---|---|
EFSRV_IMPORT_C TInt | Adopt(RFs &, TInt) |
EFSRV_IMPORT_C TInt | AdoptFromClient(const RMessage2 &, TInt, TInt) |
EFSRV_IMPORT_C TInt | AdoptFromCreator(TInt, TInt) |
EFSRV_IMPORT_C TInt | AdoptFromServer(TInt, TInt) |
EFSRV_IMPORT_C TInt | Att(TUint &) |
EFSRV_IMPORT_C TInt | BlockMap(SBlockMapInfo &, TInt64 &, TInt64, TInt) |
EFSRV_IMPORT_C TInt | ChangeMode(TFileMode) |
TInt | Clamp(RFileClamp &) |
EFSRV_IMPORT_C void | Close() |
EFSRV_IMPORT_C TInt | Create(RFs &, const TDesC &, TUint) |
EFSRV_IMPORT_C TInt | Drive(TInt &, TDriveInfo &) |
EFSRV_IMPORT_C TInt | Duplicate(const RFile &, TOwnerType) |
EFSRV_IMPORT_C TInt | Flush() |
EFSRV_IMPORT_C void | Flush(TRequestStatus &) |
EFSRV_IMPORT_C TInt | FullName(TDes &) |
EFSRV_IMPORT_C TInt | Lock(TInt, TInt) |
EFSRV_IMPORT_C TInt | Modified(TTime &) |
EFSRV_IMPORT_C TInt | Name(TDes &) |
EFSRV_IMPORT_C TInt | Open(RFs &, const TDesC &, TUint) |
EFSRV_IMPORT_C TInt | Read(TDes8 &) |
EFSRV_IMPORT_C void | Read(TDes8 &, TRequestStatus &) |
EFSRV_IMPORT_C TInt | Read(TDes8 &, TInt) |
EFSRV_IMPORT_C void | Read(TDes8 &, TInt, TRequestStatus &) |
EFSRV_IMPORT_C TInt | Read(TInt, TDes8 &) |
EFSRV_IMPORT_C void | Read(TInt, TDes8 &, TRequestStatus &) |
EFSRV_IMPORT_C TInt | Read(TInt, TDes8 &, TInt) |
EFSRV_IMPORT_C void | Read(TInt, TDes8 &, TInt, TRequestStatus &) |
EFSRV_IMPORT_C void | ReadCancel(TRequestStatus &) |
EFSRV_IMPORT_C void | ReadCancel() |
EFSRV_IMPORT_C TInt | Rename(const TDesC &) |
EFSRV_IMPORT_C TInt | Replace(RFs &, const TDesC &, TUint) |
EFSRV_IMPORT_C TInt | Seek(TSeek, TInt &) |
EFSRV_IMPORT_C TInt | Set(const TTime &, TUint, TUint) |
EFSRV_IMPORT_C TInt | SetAtt(TUint, TUint) |
EFSRV_IMPORT_C TInt | SetModified(const TTime &) |
EFSRV_IMPORT_C TInt | SetSize(TInt) |
EFSRV_IMPORT_C TInt | Size(TInt &) |
EFSRV_IMPORT_C TInt | Temp(RFs &, const TDesC &, TFileName &, TUint) |
EFSRV_IMPORT_C TInt | TransferToClient(const RMessage2 &, TInt) |
EFSRV_IMPORT_C TInt | TransferToProcess(RProcess &, TInt, TInt) |
EFSRV_IMPORT_C TInt | TransferToServer(TIpcArgs &, TInt, TInt) |
EFSRV_IMPORT_C TInt | UnLock(TInt, TInt) |
EFSRV_IMPORT_C TInt | Write(const TDesC8 &) |
EFSRV_IMPORT_C void | Write(const TDesC8 &, TRequestStatus &) |
EFSRV_IMPORT_C TInt | Write(const TDesC8 &, TInt) |
EFSRV_IMPORT_C void | Write(const TDesC8 &, TInt, TRequestStatus &) |
EFSRV_IMPORT_C TInt | Write(TInt, const TDesC8 &) |
EFSRV_IMPORT_C void | Write(TInt, const TDesC8 &, TRequestStatus &) |
EFSRV_IMPORT_C TInt | Write(TInt, const TDesC8 &, TInt) |
EFSRV_IMPORT_C void | Write(TInt, const TDesC8 &, TInt, TRequestStatus &) |
Protected Member Functions | |
---|---|
void | CloseSubSession(TInt) |
TInt | CreateSubSession(const RSessionBase &, TInt, const TIpcArgs &) |
TInt | DuplicateHandle(TInt &) |
TInt | SendReceive(TInt, const TIpcArgs &) |
EFSRV_IMPORT_C TInt | AdoptFromClient | ( | const RMessage2 & | aMsg, |
TInt | aFsHandleIndex, | |||
TInt | aFileHandleIndex | |||
) |
EFSRV_IMPORT_C TInt | AdoptFromCreator | ( | TInt | aFsIndex, |
TInt | aFileHandleIndex | |||
) |
EFSRV_IMPORT_C TInt | BlockMap | ( | SBlockMapInfo & | aInfo, |
TInt64 & | aStartPos, | |||
TInt64 | aEndPos = -1, | |||
TInt | aBlockMapusage = EBlockMapUsagePaging | |||
) | const |
SBlockMapInfo & aInfo | |
TInt64 & aStartPos | |
TInt64 aEndPos = -1 | |
TInt aBlockMapusage = EBlockMapUsagePaging |
EFSRV_IMPORT_C TInt | Create | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode | |||
) |
TInt | CreateSubSession | ( | const RSessionBase & | aSession, |
TInt | aFunction, | |||
const TIpcArgs & | aArgs | |||
) | [protected] |
Creates a new sub-session within an existing session.
KErrNone if successful, otherwise one of the system-wide error codes.
const RSessionBase & aSession | The session to which this sub-session will belong. |
TInt aFunction | The opcode specifying the requested service; the server should interpret this as a request to create a sub-session. |
const TIpcArgs & aArgs | The message arguments. |
EFSRV_IMPORT_C TInt | Drive | ( | TInt & | aDriveNumber, |
TDriveInfo & | aDriveInfo | |||
) | const |
TInt & aDriveNumber | |
TDriveInfo & aDriveInfo |
EFSRV_IMPORT_C TInt | Duplicate | ( | const RFile & | aFile, |
TOwnerType | aType = EOwnerProcess | |||
) |
const RFile & aFile | |
TOwnerType aType = EOwnerProcess |
TInt | DuplicateHandle | ( | TInt & | aSubSessionHandle | ) | const [protected] |
TInt & aSubSessionHandle |
EFSRV_IMPORT_C void | Flush | ( | TRequestStatus & | aStatus | ) |
TRequestStatus & aStatus |
EFSRV_IMPORT_C TInt | Open | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode | |||
) |
EFSRV_IMPORT_C void | Read | ( | TDes8 & | aDes, |
TRequestStatus & | aStatus | |||
) | const |
TDes8 & aDes | |
TRequestStatus & aStatus |
EFSRV_IMPORT_C void | Read | ( | TDes8 & | aDes, |
TInt | aLength, | |||
TRequestStatus & | aStatus | |||
) | const |
TDes8 & aDes | |
TInt aLength | |
TRequestStatus & aStatus |
EFSRV_IMPORT_C void | Read | ( | TInt | aPos, |
TDes8 & | aDes, | |||
TRequestStatus & | aStatus | |||
) | const |
TInt aPos | |
TDes8 & aDes | |
TRequestStatus & aStatus |
EFSRV_IMPORT_C void | Read | ( | TInt | aPos, |
TDes8 & | aDes, | |||
TInt | aLength, | |||
TRequestStatus & | aStatus | |||
) | const |
TInt aPos | |
TDes8 & aDes | |
TInt aLength | |
TRequestStatus & aStatus |
EFSRV_IMPORT_C void | ReadCancel | ( | TRequestStatus & | aStatus | ) | const |
TRequestStatus & aStatus |
EFSRV_IMPORT_C TInt | Rename | ( | const TDesC & | aNewName | ) |
const TDesC & aNewName |
EFSRV_IMPORT_C TInt | Replace | ( | RFs & | aFs, |
const TDesC & | aName, | |||
TUint | aFileMode | |||
) |
TInt | SendReceive | ( | TInt | aFunction, |
const TIpcArgs & | aArgs | |||
) | const [protected] |
Sends a message to the server and waits synchronously for a reply.
An opcode specifies the service required. A set of message arguments is passed that can be used to specify client addresses, which the server can use to read from and write to the client address space.
Note that this function will only fail if the server itself fails or environmental errors occur in the server. All requests made using this function are guaranteed to reach the server. This means that all synchronous client requests (typically those that return void) should be routed through this synchronous variant of SendReceive().
KErrNone if successful, otherwise one of the system-wide error codes.
EFSRV_IMPORT_C TInt | Set | ( | const TTime & | aTime, |
TUint | aSetAttMask, | |||
TUint | aClearAttMask | |||
) |
EFSRV_IMPORT_C TInt | SetModified | ( | const TTime & | aTime | ) |
const TTime & aTime |
EFSRV_IMPORT_C TInt | Temp | ( | RFs & | aFs, |
const TDesC & | aPath, | |||
TFileName & | aName, | |||
TUint | aFileMode | |||
) |
EFSRV_IMPORT_C TInt | TransferToClient | ( | const RMessage2 & | aMsg, |
TInt | aFileHandleIndex | |||
) | const |
EFSRV_IMPORT_C TInt | TransferToProcess | ( | RProcess & | aProcess, |
TInt | aFsHandleIndex, | |||
TInt | aFileHandleIndex | |||
) | const |
EFSRV_IMPORT_C TInt | TransferToServer | ( | TIpcArgs & | aIpcArgs, |
TInt | aFsHandleIndex, | |||
TInt | aFileHandleIndex | |||
) | const |
EFSRV_IMPORT_C void | Write | ( | const TDesC8 & | aDes, |
TRequestStatus & | aStatus | |||
) |
const TDesC8 & aDes | |
TRequestStatus & aStatus |
EFSRV_IMPORT_C void | Write | ( | const TDesC8 & | aDes, |
TInt | aLength, | |||
TRequestStatus & | aStatus | |||
) |
const TDesC8 & aDes | |
TInt aLength | |
TRequestStatus & aStatus |
EFSRV_IMPORT_C void | Write | ( | TInt | aPos, |
const TDesC8 & | aDes, | |||
TRequestStatus & | aStatus | |||
) |
TInt aPos | |
const TDesC8 & aDes | |
TRequestStatus & aStatus |
EFSRV_IMPORT_C TInt | Write | ( | TInt | aPos, |
const TDesC8 & | aDes, | |||
TInt | aLength | |||
) |
EFSRV_IMPORT_C void | Write | ( | TInt | aPos, |
const TDesC8 & | aDes, | |||
TInt | aLength, | |||
TRequestStatus & | aStatus | |||
) |
TInt aPos | |
const TDesC8 & aDes | |
TInt aLength | |
TRequestStatus & aStatus |