Public Member Functions | Static Public Member Functions | Protected Attributes

OFFile Class Reference

A class which provides functions to read, write and manipulate files. More...

#import <OFFile.h>

Inheritance diagram for OFFile:
OFSeekableStream OFStream OFObject <OFObject>

List of all members.

Public Member Functions

(id) - initWithPath:mode:
(id) - initWithFileDescriptor:

Static Public Member Functions

(id) + fileWithPath:mode:
(id) + fileWithFileDescriptor:
(OFString *) + currentDirectoryPath
(BOOL) + fileExistsAtPath:
(BOOL) + directoryExistsAtPath:
(void) + createDirectoryAtPath:
(OFArray *) + filesInDirectoryAtPath:
(void) + changeToDirectory:
(OFDate *) + modificationDateOfFile:
(void) + changeModeOfFile:toMode:
(void) + changeOwnerOfFile:toOwner:group:
(void) + copyFileAtPath:toPath:
(void) + renameFileAtPath:toPath:
(void) + deleteFileAtPath:
(void) + deleteDirectoryAtPath:
(void) + linkFileAtPath:toPath:
(void) + symlinkFileAtPath:toPath:

Protected Attributes

int fd
BOOL closable
BOOL eos

Detailed Description

A class which provides functions to read, write and manipulate files.


Member Function Documentation

+ (void) changeModeOfFile: (OFString*)  path
toMode: (mode_t)  mode 

Changes the mode of a file.

Only changes read-only flag on Windows.

Parameters:
path The path to the file of which the mode should be changed as a string
mode The new mode for the file
+ (void) changeOwnerOfFile: (OFString*)  path
toOwner: (OFString*)  owner
group: (OFString*)  group 

Changes the owner of a file.

Not available on Windows.

Parameters:
path The path to the file of which the owner should be changed as a string
owner The new owner for the file
group The new group for the file
+ (void) changeToDirectory: (OFString*)  path  

Changes the current working directory.

Parameters:
path The new directory to change to
+ (void) copyFileAtPath: (OFString*)  from
toPath: (OFString*)  to 

Copies a file.

Parameters:
from The file to copy
to The destination path
+ (void) createDirectoryAtPath: (OFString*)  path  

Creates a directory at the specified path.

Parameters:
path The path of the directory
+ (OFString *) currentDirectoryPath  
Returns:
The path of the current working directory
+ (void) deleteDirectoryAtPath: (OFString*)  path  

Deletes an empty directory.

Parameters:
path The path to the directory which should be deleted as a string
+ (void) deleteFileAtPath: (OFString*)  path  

Deletes a file.

Parameters:
path The path to the file of which should be deleted as a string
+ (BOOL) directoryExistsAtPath: (OFString*)  path  
Parameters:
path The path to check
Returns:
A boolean whether there is a directory at the specified path
+ (BOOL) fileExistsAtPath: (OFString*)  path  
Parameters:
path The path to check
Returns:
A boolean whether there is a file at the specified path
+ (OFArray *) filesInDirectoryAtPath: (OFString*)  path  
Parameters:
path The path of the directory
Returns:
An array of OFStrings with the files at the specified path
+ (id) fileWithFileDescriptor: (int)  fd  
Parameters:
fd A file descriptor, returned from for example open(). It is not closed when the OFFile object is deallocated!
Returns:
A new autoreleased OFFile
+ (id) fileWithPath: (OFString*)  path
mode: (OFString*)  mode 
Parameters:
path The path to the file to open as a string
mode The mode in which the file should be opened as a string
Returns:
A new autoreleased OFFile
- (id) initWithFileDescriptor: (int)  fd  

Initializes an already allocated OFFile.

Parameters:
fd A file descriptor, returned from for example open(). It is not closed when the OFFile object is deallocated!
- (id) initWithPath: (OFString*)  path
mode: (OFString*)  mode 

Initializes an already allocated OFFile.

Parameters:
path The path to the file to open as a string
mode The mode in which the file should be opened as a string
Returns:
An initialized OFFile
+ (void) linkFileAtPath: (OFString*)  src
toPath: (OFString*)  dest 

Hardlinks a file.

Not available on Windows.

Parameters:
src The path to the file of which should be linked as a string
dest The path to where the file should be linked as a string
+ (OFDate *) modificationDateOfFile: (OFString*)  path  
Returns:
The date of the last modification of the file
+ (void) renameFileAtPath: (OFString*)  from
toPath: (OFString*)  to 

Renames a file.

Parameters:
from The file to rename
to The new name
+ (void) symlinkFileAtPath: (OFString*)  src
toPath: (OFString*)  dest 

Symlinks a file.

Not available on Windows.

Parameters:
src The path to the file of which should be symlinked as a string
dest The path to where the file should be symlinked as a string

The documentation for this class was generated from the following files:
 All Classes Functions Variables