File tom/File


class tom.File

The File class offers an abstraction from files in the filesystem.

Inherits

State supers
ByteStream, SeekableStream, Constants, Conditions

variables

const OPEN_INPUT = 256;
const OPEN_OUTPUT = 512;

methods

String
            basename String filename
  without-extension: String ext = nil;
Return the filename removing any directory component, and removing the extension ext if it matches and is not nil.

String
  current_directory;
Return the current directory, as a directory name (tailing slash).

void
  set_current_directory String directory;
Set the current directory. This raises a file-error when problems arise.

String
  directory-of-file String name;
Return the directory-name of the directory containing the file named filename.

String
  expand-filename String filename
     relative-to: String directory = nil;
Expand the filename relative to the directory. If directory is nil, expansion is relative to the current working directory.

String
  express-filename String filename
       relative-to String directory;
Express the filename in terms relative to the directory.

String
  filename-as-directory String filename;
Return the filename as the name of a directory.

MutableArray
  filenames-in-directory String dir_name;
Return the filenames in the directory named dir_name.

String
  locate-file String file
   along-path Indexed path;
Return the filename of the file somewhere along the path. Return nil if it could not be found.

boolean
  file-exists String name;
Return YES iff the file with the name exists.

int
  type-of-file String name
  follow-link: boolean follow_link = YES;
Return one of the FILE_TYPE_* constants.

instance (id)
     open String name
   input: boolean input_p = FALSE
  output: boolean output_p = FALSE
   flags: int action = 0;
Return a new File.

instance (id)
        open String name
   alongPath Indexed path
     subdir: String subdir1 = nil
  subsubdir: String subdir2 = nil;
Search for the file along the path.

For the subdirectories subdir1 and subdir2, when not nil, the following attempts are made for a dir in the path: dir, dir/subdir2, dir/subdir1, and dir/subdir1/subdir2.

void
  remove String name;
Remove the file or directory with the name.

instance tom.File

variables

public String name;
The name of the file.
int flags;
If it is to be reopenend, these are the flags indicating how to do so.

methods

protected id
   init String n
  flags int f;
Designated initializer.

String
  directoryName;
Return the name of the directory containing our file.

id
  reopen;
Reopen the file according to the flags.

int
  type-of-file;
Return one of the FILE_TYPE_* constants for the receiving File. If the file is not open, the file is tested as if the file were open, i.e. following links.

OutputStream
  writeFields OutputStream s;
Undocumented.

Positioning

long
  length;
Return the length of the file.

long
  position;
Return the current file position.

void
       seek long offset
  relative: int whence = STREAM_SEEK_SET;
Position the file `pointer'.


Generated by tm 1.01.