xflminterface IF_FileHdl : public XF_RefCount


This class represents the file handle interface. It extends XF_RefCount and provides functionality for accessing files in a file system.


Method Summary

RCODE  Close - close the file
RCODE  Create - create a new file
RCODE  CreateUnique - create a file using an automatically generated name
RCODE  Open - open an existing file
RCODE  Flush - force any changes to be written to disk
RCODE  Read - read data from the file
RCODE  Seek - adjust the current file position
RCODE  Size - report the size of the file
RCODE  Tell - report the current file position
RCODE  Truncate - truncate the file to a specified size
RCODE  Write - write data to the file
RCODE  SectorRead - reads data from disk in sector sized chunks
RCODE  SectorWrite - writes data to disk in sector sized chunks
FLMBOOL  CanDoAsync - returns TRUE if the file can do asynchronous I/O
RCODE  setExtendSize - set the amount to automatically grow files
RCODE  setMaxAutoExtendSize - sets the maximum size a file will grow to
   

 

Method Detail

Close

    RCODE Close( void);

Close the file referred to by this handle.

    Parameters In: none.

    Parameters Out: none.

    See Also:

[Back to Top]


Create

    RCODE Create(

        char *            pszFileName,

        FLMUINT    uiIoFlags);

Create a new file.

    Parameters In:

char * pszFileName The name of the file to create.
FLMUINT uiIoFlags Any flags associated with the file (read-only, exclusive, etc)

    Parameters Out: none.

    See Also:

[Back to Top]


CreateUnique

    RCODE CreateUnique(

        char *            pszDirName,

        char *            pszFileExtension

        FLMUINT    uiIoFlags);

Create a file using an automatically generated name that is guaranteed to be unique.

    Parameters In:

char * pszDirName The name of the directory where the file will be created.
char * pszFileExtension The extension to append to the filename.
FLMUINT uiIoFlags Any flags associated with the file (read-only, exclusive, etc)

    Parameters Out: none.

    See Also:

[Back to Top]


Open

    RCODE Open(

        char *            pszFileName,

        FLMUINT    uiIoFlags);

Open the specified file.

    Parameters In:

char * pszFileName The name of the file to open.
FLMUINT uiIoFlags Any flags associated with the file (read-only, exclusive, etc)

    Parameters Out: none.

    See Also:

[Back to Top]


Flush

    RCODE Flush( void);

Force any changes to be written to disk.

    Parameters In: none.

    Parameters Out: none.

    See Also:

[Back to Top]


Read

    RCODE Read(

        FLMUINT       uiOffset,

        FLMUINT       uiLength,

        void *               pvBuffer,

        FLMUINT *    puiBytesRead);

 

Reads the specified amount of data from the specified location in the file.  If uiOffset is set to the flag F_IO_CURRENT_POS, then

the read takes place at the current location of the file.

    Parameters In:

FLMUINT uiOffset The offset into the file (in bytes) to begin reading.

FLMUINT uiLength

The number of bytes to be read.
void * pvBuffer A buffer to store the data in.  (It must be at least uiLength bytes long.)

    Parameters Out:

FLMUINT * puiBytesRead The number of bytes that were actually read.

    See Also:

[Back to Top]


Seek

    RCODE Seek(

        FLMUINT       uiOffset,

        FLMINT          iWhence,

        FLMUINT *    puiNewOffset);

 

Changes the current location of the file pointer.  Depending on the value of iWhence, the location may change uiOffset bytes from its current position, uiOffset bytes from the start of the file, or may simply move to the end of the file.

    Parameters In:

FLMUINT uiOffset The number of bytes to offset into the file (in bytes) to begin reading.

FLMINT iWhence

Flag indiciating what part of the file uiOffset is in relation to.

    Parameters Out:

FLMUINT * puiNewOffset The location of the file pointer.

    See Also:

[Back to Top]


Size

    RCODE Size(

        FLMUINT *    puiSize);

 

Returns the size of the file in puiSize.  (The file must already be open.)

    Parameters In: none.

    Parameters Out:

FLMUINT * puiSize The size of the file.

    See Also:

[Back to Top]


Tell

    RCODE Tell(

        FLMUINT *    puiOffset);

 

Returns the current position of the file pointer in puiOffset.

    Parameters In: none.

    Parameters Out:

FLMUINT * puiOffset The current position of the file pointer.

    See Also:

[Back to Top]


Truncate

    RCODE Truncate(

        FLMUINT     uiSize);

 

Truncates the file to the specified size.

    Parameters In:

FLMUINT uiSize The new size of the file.

    Parameters Out: none.

    See Also:

[Back to Top]


Write

    RCODE Write(

        FLMUINT       uiOffset,

        FLMUINT       uiLength,

        void *               pvBuffer,

        FLMUINT *    puiBytesWritten);

Writes the specified data at the specified location in the file.

    Parameters In:

FLMUINT uiOffset The offset into the file (in bytes) to begin writing.

FLMUINT uiLength

The number of bytes to be written.
void * pvBuffer A buffer holding the data to be written.

    Parameters Out:

FLMUINT * puiBytesWritten The number of bytes that were actually written.

    See Also:

[Back to Top]


SectorRead

    RCODE SectorRead(

        FLMUINT       uiReadOffset,

        FLMUINT       uiBytesToRead,

        void *               pvBuffer,

        FLMUINT *    puiBytesReadRV);

Reads the specified number of bytes starting at the specified offset in the file.  Note that uiReadOffset must fall on a sector boundary and uiBytesToRead must be a multiple of the sector size.

    Parameters In:

FLMUINT uiReadOffset The offset into the file (in bytes) to start reading.

FLMUINT uiBytesToRead

The number of bytes to read.
void * pvBuffer A buffer for storing the data that was read

    Parameters Out:

FLMUINT * puiBytesReadRV The number of bytes that were actually read.

    See Also:

[Back to Top]


SectorWrite

    RCODE SectorWrite(

        FLMUINT       uiWriteOffset,

        FLMUINT       uiBytesToWrite,

        void *               pvBuffer,

        FLMUINT       uiBufferSize,

        void *               pvBufferObj,

        FLMUINT *    puiBytesWrittenRV,

        FLMBOOL      bZeroFill = TRUE);

Writes the specified data at the specified location in the file.  uiWriteOffset must fall on a sector boundary.  uiBufferSize must be an integral multiple of the sector size. 

    Parameters In:

FLMUINT uiWriteOffset The offset into the file (in bytes) to begin writing.

FLMUINT uiBytesToWrite

The number of bytes to be written.
void * pvBuffer A buffer holding the data to be written.
FLMUINT uiBufferSize  
void * pvBufferObj  
FLMUINT * puiBytesWrittenRV  
FLMBOOL bZeroFill  

    Parameters Out:

FLMUINT * puiBytesWritten The number of bytes that were actually written.

    See Also:

[Back to Top]


CanDoAsync

    FLMBOOL CanDoAsync( void);

Returns TRUE if the file is set up for asynchronous I/O.

    Parameters In: none.

    Parameters Out: none.

    See Also:

[Back to Top]


SetExtendSize

    void SetExtendSize(

        FLMUINT        uiExtendSize);

The amount that the file will be extended by (in bytes) when a write operation exceeds the current file size.

    Parameters In:

FLMUINT uiExtendSize  

    Parameters Out: none.

    See Also:

[Back to Top]


SetMaxAutoExtendSize

    void SetMaxAutoExtendSize(

        FLMUINT        uiMaxAutoExtendSize);

Set the maximum size (in bytes) the file will grow to.

    Parameters In:

FLMUINT uiMaxAutoExtendSize  

    Parameters Out: none.

    See Also:

[Back to Top]