Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15
 Overview   Namespace   Class   Index   Help 

Methods of Class File


File
File(
File & );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO NO

Summary
define copy c'tor and assginment operator privat

operator=
File & operator=(
File & );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO NO NO


File
File(
const ::rtl::OUString & strPath );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
C'tor

Parameters
strPath
The full qualified path of the file in UNC notation.
      The path delimiter is '/'. Relative paths are not allowed.
     

~File
~File();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
D'tor

close
RC close();

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Closes an open file.

Return
E_None on success otherwise one of the following errorcodes:<p>
     E_INVAL        the format of the parameters was not valid<p>

     These errorcodes can (eventually) be returned:<p>
     E_BADF            Bad file<br>
     E_INTR            function call was interrupted<br>
     E_NOLINK        Link has been severed<br>
     E_NOSPC        No space left on device<br>
     E_IO            I/O error<p>
    

setPos
RC setPos(
sal_uInt32 uHow,
sal_Int64 uPos );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Sets the internal position pointer of an open file.
Parameters
uHow
Distance to move the internal position pointer (from uPos).
uPos
Absolute position from the beginning of the file.
Return
E_None on success otherwise one of the following errorcodes:<p>
E_INVAL        the format of the parameters was not valid<br>
E_OVERFLOW        The resulting file offset would be a value which cannot
be represented correctly for regular files<p>

See Also
open
getPos

getPos
RC getPos(
sal_uInt64 & uPos );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Retrieves the current position of the internal pointer of an open file.
Parameters
pPos
On Success it receives the current position of the file pointer.
Return
E_None on success otherwise one of the following errorcodes:<p>
E_INVAL        the format of the parameters was not valid<br>
E_OVERFLOW        The resulting file offset would be a value which cannot
be represented correctly for regular files<p>

See Also
open
setPos
read
write

isEndOfFile
RC isEndOfFile(
sal_Bool * pIsEOF );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Tests if the end of a file is reached.    
Parameters
pIsEOF
Points to a variable that receives the end of file
status.
Return
E_None on success otherwise one of the following errorcodes:<p> 
E_INVAL the format of the parameter was not valid<br>

These errorcodes can (eventually) be returned:<p>
E_INTR        function call was interrupted<br>
E_IO        I/O error<br>
E_ISDIR        Is a directory<br>
E_BADF        Bad file<br>
E_FAULT        Bad address<br>
E_AGAIN        Operation would block<br>
E_NOLINK    Link has been severed<p>

See Also
open
read
readLine
setFilePos

setSize
RC setSize(
sal_uInt64 uSize );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Sets the file size of an open file. The file can be truncated or enlarged by the function.
The position of the file pointer is not affeced by this function.
Parameters
uSize
New size in bytes.
Return
E_None on success otherwise one of the following errorcodes:<p>
E_INVAL        the format of the parameters was not valid<br>
E_OVERFLOW        The resulting file offset would be a value which cannot
be represented correctly for regular files<p>

See Also
open
setPos
getStatus

read
RC read(
void * pBuffer,
sal_uInt64 uBytesRequested,
sal_uInt64 & rBytesRead );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Reads a number of bytes from a file. The internal file pointer is increased by the number of bytes
read.
Parameters
pBuffer
Points to a buffer which receives data. The buffer must be large enough
to hold <code>uBytesRequested</code> bytes.
uBytesRequested
Number of bytes which should be retrieved.
rBytesRead
On success the number of bytes which have actually been retrieved.
Return
E_None on success otherwise one of the following errorcodes:<p>
E_INVAL        the format of the parameters was not valid<br>

These errorcodes can (eventually) be returned:<p>
E_INTR            function call was interrupted<br>
E_IO            I/O error<br>
E_ISDIR        Is a directory<br>
E_BADF            Bad file<br>
E_FAULT        Bad address<br>
E_AGAIN        Operation would block<br>
E_NOLINK        Link has been severed<p>

See Also
open
write
setPos

write
RC write(
const void * pBuffer,
sal_uInt64 uBytesToWrite,
sal_uInt64 & rBytesWritten );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Writes a number of bytes to a file. The internal file pointer is increased by the number of bytes
read.
Parameters
pBuffer
Points to a buffer which contains the data.
uBytesToWrite
Number of bytes which should be written.
rBytesWritten
On success the number of bytes which have actually been written.

Return
E_None on success otherwise one of the following errorcodes:<p>
E_INVAL        the format of the parameters was not valid<br>
E_FBIG            File too large<br>
E_DQUOT        Quota exceeded<p>

These errorcodes can (eventually) be returned:<p>
E_AGAIN        Operation would block<br>
E_BADF            Bad file<br>
E_FAULT        Bad address<br>
E_INTR            function call was interrupted<br>
E_IO            I/O error<br>
E_NOLCK        No record locks available<br>
E_NOLINK        Link has been severed<br>
E_NOSPC        No space left on device<br>
E_NXIO            No such device or address<p>

See Also
openFile
readFile
setFilePos

readLine
RC readLine(
::rtl::ByteSequence & aSeq );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO NO YES NO

Summary
Reads a line from given file. The new line delemeter(s) are NOT returned!

Parameters
Handle
Handle to an open file.
        
ppSequence
a pointer to a valid sequence. Will hold the line read on return.
        
Return
osl_File_E_None on success otherwise one of the following errorcodes:<p> 
        osl_File_E_INVAL        the format of the parameters was not valid<br>

        These errorcodes can (eventually) be returned:<p>
        osl_File_E_INTR            function call was interrupted<br>
        osl_File_E_IO            I/O error<br>
        osl_File_E_ISDIR        Is a directory<br>
        osl_File_E_BADF            Bad file<br>
        osl_File_E_FAULT        Bad address<br>
        osl_File_E_AGAIN        Operation would block<br>
        osl_File_E_NOLINK        Link has been severed<p>

        
See Also
osl_openFile
osl_readFile
osl_writeFile
osl_setFilePos

copy
static RC copy(
const ::rtl::OUString & strPath,
const ::rtl::OUString & strDestPath );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Copies a file to a new destination. Copies only files not directories. No assumptions should
be made about preserving attributes or file time.
Parameters
strPath
Full qualified UNC path of the source file.
strDestPath
Full qualified UNC path of the destination file. A directory is
NOT a valid destination file !
Return
E_None on success otherwise one of the following errorcodes:<p>
E_INVAL        the format of the parameters was not valid<br>
E_NOMEM        not enough memory for allocating structures <br>
E_ACCES        Permission denied<br>
E_PERM            Operation not permitted<br>
E_NAMETOOLONG    File name too long<br>
E_NOENT        No such file or directory<br>
E_ISDIR        Is a directory<br>
E_ROFS            Read-only file system<p>

See Also
move
remove

move
static RC move(
const ::rtl::OUString & strPath,
const ::rtl::OUString & strDestPath );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Moves a file or directory to a new destination or renames it. File time and attributes
are preserved.
Parameters
strPath
Full qualified UNC path of the source file.
strDestPath
Full qualified UNC path of the destination file. An existing directory
is NOT a valid destination !
Return
E_None on success otherwise one of the following errorcodes:<p>
E_INVAL        the format of the parameters was not valid<br>
E_NOMEM        not enough memory for allocating structures <br>
E_ACCES        Permission denied<br>
E_PERM            Operation not permitted<br>
E_NAMETOOLONG    File name too long<br>
E_NOENT        No such file or directory<br>
E_ROFS            Read-only file system<p>

See Also
copy

remove
static RC remove(
const ::rtl::OUString & strPath );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Removes (erases) a regular file.

Parameters
strPath
Full qualified UNC path of the directory.
     
Return
E_None on success otherwise one of the following errorcodes:<p>
     E_INVAL        the format of the parameters was not valid<br>
     E_NOMEM        not enough memory for allocating structures <br>
     E_ACCES        Permission denied<br>
     E_PERM            Operation not permitted<br>
     E_NAMETOOLONG    File name too long<br>
     E_NOENT        No such file or directory<br>
     E_ISDIR        Is a directory<br>
     E_ROFS            Read-only file system<p>

     These errorcodes can (eventually) be returned:<p>
     E_FAULT        Bad address<br>
     E_LOOP            Too many symbolic links encountered<br>
     E_IO            I/O error<br>
     E_BUSY            Device or resource busy<br>
     E_INTR            function call was interrupted<br>
     E_LOOP            Too many symbolic links encountered<br>
     E_MULTIHOP        Multihop attempted<br>
     E_NOLINK        Link has been severed<br>
     E_TXTBSY        Text file busy<p>
    

setAttributes
static RC setAttributes(
const ::rtl::OUString & strPath,
sal_uInt64 uAttributes );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Sets file-attributes

Parameters
filePath[in]
Path of the file
     
uAttributes[in]
Attributes of the file to be set

     
Return
E_None on success otherwise one of the following errorcodes:<p>
     E_INVAL        the format of the parameters was not valid<br>
     
See Also
getStatus

setTime
static RC setTime(
const ::rtl::OUString & strPath,
TimeValue & rCreationTime,
TimeValue & rLastAccessTime,
TimeValue & rLastWriteTime );

virtual abstract const volatile template static inline C-linkage
NO NO NO NO NO YES YES NO

Summary
Sets file-Time

Parameters
filePath[in]
Path of the file
     
aCreationTime[in]
creation time of the given file
     
aLastAccessTime[in]
time of the last access of the given file
     
aLastWriteTime[in]
time of the last modifying of the given file


     
Return
E_None on success otherwise one of the following errorcodes:<p>
     E_INVAL        the format of the parameters was not valid<br>
     E_NOENT        No such file or directory not found<br>
     
See Also
getStatus

Top of Page

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.