IFmsFileAdaptor Class Reference
[File plug-in]

The interface to an asynchronous File plug-in. More...

#include <FmsFileAdaptor.h>

List of all members.

Public Types

enum  RemoveFlags {
  kFile = 0, kDirs = 0x01, kSubDirs = 0x02, kEmptyDirs = 0x04,
  kWildCards = 0x08
}
 Various flags to control file and directory removal. More...

Public Member Functions

virtual int open (const char *sFileName, int iFlags, int iMode, int *pAttrKeys, int nAttrs, void *pCtx)=0
virtual int getAttributes (const char *sFileName, int *pAttrKeys, int nAttrs, void *pCtx)=0
virtual int getAttributes (int iHandle, int *pAttrKeys, int nAttrs, void *pCtx)=0
virtual int read (int iHandle, I64 uOffset, char *pBuffer, int nBytes, void *pCtx)=0
virtual int write (int iHandle, I64 uOffset, char *pBuffer, int nBytes, void *pCtx)=0
virtual int close (int iHandle, void *pCtx)=0
virtual int remove (const char *sFileName, unsigned long uFlags, void *pCtx)=0
virtual int createDir (const char *sFileName, void *pCtx)=0
virtual ~IFmsFileAdaptor ()


Detailed Description

The server calls the methods on this class to initiate asynchronous file operations. The interface adheres to strict limited memory lifetime requirements, wherein any pointers can be assumed to be valid only within the function call. The read and write buffers are an exception and are valid for the duration of the asynchronous operation. Strings will always be null-terminated and UTF-8 encoded.

Member Enumeration Documentation

enum IFmsFileAdaptor::RemoveFlags

Various flags to control file and directory removal. Only files are removed by default. The kDirs flag enables removal of directories and the kSubDirs flag enables recursive removal of subdirectories. Use the kEmptyDirs flag to enforce that only empty directories are removed. Use the kWildCards flag to enable simple DOS wild cards; they are not enabled by default.

Enumerator:
kFile  Allow file removal.
kDirs  Allow directory removal.
kSubDirs  Allow recursive removal.
kEmptyDirs  Remove empty directories only.
kWildCards  Enable simple DOS wild cards.


Constructor & Destructor Documentation

virtual IFmsFileAdaptor::~IFmsFileAdaptor (  )  [virtual]


Member Function Documentation

virtual int IFmsFileAdaptor::open ( const char *  sFileName,
int  iFlags,
int  iMode,
int *  pAttrKeys,
int  nAttrs,
void *  pCtx 
) [pure virtual]

Opens the specified file. This operation is performed asynchronously; the handle is returned in the onOpen() callback.

Parameters:
sFileName Null-terminated UTF-8 string containing the name of the file to be opened. The lifetime of the string beyond the call is not guaranteed. The callee must copy the string if necessary.
iFlags Bit flags describing the mode in which the file is opened. The value of the flag must conform to the standard open system call on the OS platform that is running the server.
iMode Creation mode in case the file is being created. The value must conform to the standard open system call on the OS platform that is running the server.
pAttrKeys An array of keys for all the attributes being queried; see the enumeration in the FmsFileAttribute structure for attributes. This array is defined only during this function call; if the callee needs it beyond that, it must make a copy. This may be null if no attributes need to be reported back in onOpen().
nAttrs The number of elements in the pAttrKeys array, and should be ignored when pAttrKeys is null.
pCtx An opaque context for this operation that must be returned in the corresponding callback function.
Returns:
int Returns 0 if the operation is allowed to execute. A return value of -1 indicates an error.

virtual int IFmsFileAdaptor::getAttributes ( const char *  sFileName,
int *  pAttrKeys,
int  nAttrs,
void *  pCtx 
) [pure virtual]

Requests one or more file attributes for a previously opened file handle.

Parameters:
sFileName Null-terminated UTF-8 string containing the name of the file to be opened. The lifetime of the string beyond the call is not guaranteed; the callee must copy the string if necessary.
pAttrKeys An array of keys for all the attributes being queried; see the enumeration in the FmsFileAttribute structure for various attributes. This array is defined only during this function call; if the callee needs it beyond that, it must make a copy. This will never be null, unlike the usage in open().
pAttrKeys An array of keys for attribute values needed at the time the file is opened. This may be null if no attributes are needed. The lifetime of the array is not defined beyond the call, so the callee must copy the array if necessary.
nAttrs The number of elements in the pAttrKeys array.
pCtx An opaque context for this operation that must be returned in the corresponding callback function.
Returns:
int Returns 0 if the operation is allowed to execute. A return value of -1 indicates an error.

virtual int IFmsFileAdaptor::getAttributes ( int  iHandle,
int *  pAttrKeys,
int  nAttrs,
void *  pCtx 
) [pure virtual]

Requests one or more file attributes for a previously opened file handle.

Parameters:
iHandle A handle to a previously opened file.
pAttrKeys An array of keys for all the attributes being queried; see the enumeration in the FmsFileAttribute struct for various attributes. This array is defined only during this function call; if the callee needs it beyond that, it must make a copy. This will never be null, unlike the usage in open().
pAttrKeys An array of keys for attribute values needed at the time the file is opened. This may be null if no attributes are needed. The lifetime of the array is not defined beyond the call, so the callee must copy the array if necessary.
nAttrs The number of elements in the pAttrKeys array.
pCtx An opaque context for this operation that must be returned in the corresponding callback function.
Returns:
int Returns 0 if the operation is allowed to execute. A return value of -1 indicates an error.

virtual int IFmsFileAdaptor::read ( int  iHandle,
I64  uOffset,
char *  pBuffer,
int  nBytes,
void *  pCtx 
) [pure virtual]

Initiates an asynchronous file read operation.

Parameters:
iHandle A handle to a previously opened file.
uOffset The 64-bit file offset at which the read must be performed.
pBuffer A buffer into which to read the data. This buffer is guaranteed to be valid beyond the function call through the completion of the asynchronous read operation.
nBytes The number of bytes to read.
pCtx An opaque context for this operation that must be returned in the corresponding callback function.
Returns:
int Returns 0 if the operation is allowed to execute. The onRead() function is called and Flash Media Server is notified that the data has been read. A return value of -1 indicates an error. Returning -1 tells Flash Media Server that execution of this command should stop. If you return -1, do not call onRead().

virtual int IFmsFileAdaptor::write ( int  iHandle,
I64  uOffset,
char *  pBuffer,
int  nBytes,
void *  pCtx 
) [pure virtual]

Initiates an asynchronous file write operation.

Parameters:
iHandle A handle to a previously opened file.
uOffset The 64-bit file offset at which the write must be performed.
pBuffer A buffer from which to write the data. This buffer is guaranteed to be valid beyond the function call through the completion of the asynchronous write operation.
nBytes The number of bytes to be read.
pCtx An opaque context for this operation that must be returned in the corresponding callback function.
Returns:
int Returns 0 if the operation is allowed to execute. A return value of -1 indicates an error.

virtual int IFmsFileAdaptor::close ( int  iHandle,
void *  pCtx 
) [pure virtual]

Initiates an asynchronous file close operation.

Parameters:
iHandle A handle to a previously opened file.
pCtx An opaque context for this operation that must be returned in the corresponding callback function if pCtx != 0. If pCtx == 0 the result upon completion is not requested by callback.
Returns:
int Returns 0 if the operation is allowed to execute. A return value of -1 indicates an error.

virtual int IFmsFileAdaptor::remove ( const char *  sFileName,
unsigned long  uFlags,
void *  pCtx 
) [pure virtual]

Initiates an asynchronous removal of files or directories.

Parameters:
sFileName Null-terminated UTF-8 string containing the name of the file or directories to be removed. The lifetime of the string beyond the function is not guaranteed; the callee must copy the string if necessary.
uFlags Flags to determine removal options: allow directory removal, allow recursive removal, remove only empty directories, and so on.
pCtx An opaque context for this operation that must be returned in the corresponding callback if pCtx != 0. If pCtx == 0 the result upon completion is not requested by callback.
Returns:
int Returns 0 if the operation is allowed to execute. A return value of -1 indicates an error.

virtual int IFmsFileAdaptor::createDir ( const char *  sFileName,
void *  pCtx 
) [pure virtual]

Creates one or more directories.

Parameters:
sFileName Null-terminated UTF-8 string containing the name of the directories to be created. The lifetime of the string beyond the function is not guaranteed, so the callee must copy the string if necessary.
pCtx An opaque context for this operation that must be returned in the corresponding callback function.
Returns:
int Returns 0 if the operation is allowed to execute. A return value of -1 indicates an error.


The documentation for this class was generated from the following file: FMS Adaptors Footer

 

©2007 Adobe Systems Incorporated.  All Rights Reserved.