Inherits Garbage. Inherited by HeaderFile and SourceFile.
Represents a file.
In the Oryx system, a file is read once on object construction and never read later, or opened and truncated, ready for later writing.
Once read, a file's contents() returns the entire contents of the file. To write to a file, write() is available. The file remains open until the destructor is called.
modificationTime() returns an integer that's bigger for more recently modified/created files, name() returns the file's name and valid() returns true or false depending on whether everything is okay.
Creates a new File object representing name. If a is Read, the contents of the file are read. If a is Write, the file is opened for writing and truncated. If a is Append, the file is opened for append. In the latter cases, the file is created with the specified mode if it does not exist.
Creates a new File object representing name, and tries to open it and read up to maxLength bytes, or the whole file if maxLength is 0.
Creates a new unnamed File representing the specified fd. This is used only by the LogServer to write to stdout.
Returns the current name of filename based on the root() in effect, if filename starts with a '/'.
If filename is a relative name, this function does nothing.
The current root() is assumed to match the chroot directory used by the operating system. If filename isn't within root(), chrooted() logs an error. Thus, when a server runs inside chroot jail, attempts to open files or unix sockets cause sensible error messages.
Returns the contents of the file as read by the constructor. If this file is being written to, not read, then contents() returns an empty string.
Initialises a file object to represent name, which is opened for the specified mode. If a is Read, maxLength specifies the number of bytes to read; and if a is Write or Append, the mode is used if the file is to be created.
Returns a non-zero pointer to a StringList containing the lines of text read from this File. The lines are returned unmodified, with trailing CRLF, if any, intact.
Returns the modification time of this file as it was at time of construction. The modification time is an opaque integer; its meaning is not specified except that more recently created/modified files have larger values of modificationTime().
Returns the name of the file, as specified to the constructor.
Returns the currently recorded root directory, which always starts and ends with a '/' character. This is just the argument of the last setRoot() call.
Records that the root directory is now d. The initial value is "/". This value is used by chrooted().
If d does not end with a '/', setRoot() appends one.
Removes the file with name s. All operating system errors are blithely ignored.
Returns true if this file was opened and read correctly, and false if the object is somehow invalid.
Writes s to the end of the file if this file is open for writing, and does nothing else.
OS errors are disregarded.
Destroyes the file and closes it if it still is open.
This web page based on source code belonging to Oryx Mail Systems GmbH. All rights reserved.