A handle to a file on disk. Supports reading, writing, seeking, and metadata queries.
Appends to the contents of the file with aSeq. Returns self.
Opens the receiver in read only mode, reads the whole contents of the file into a buffer object, closes the file and returns the buffer.
Returns a Number containing the byte at the specified byte index or Nil if the index is out of bounds.
Writes the byte value of byteNumber to the file position positionNumber. Returns self.
Returns File's name without an extension (returned Sequence consists of all characters up to final period ["."] character).
Closes the receiver if open, otherwise does nothing. Returns self.
When the file was opened via popen, sets either exitStatus or termSignal to the exit status on normal exit, or the signal causing abnormal termination.
Deprecated. See parentDirectory.
Returns contents of the file as a mutable Sequence of bytes.
Copies the file to the specified path.
Copies the file to the specified path without yielding.
Creates an empty file at the file's path. Returns self on success, nil on failure.
Returns the file's descriptor as a number.
Returns true if the file path exists, and false otherwise. If optionalPath string is provided, it tests the existance of that path instead.
System's close status (after file close).
Forces any buffered data to be written to disk. Returns self.
For each byte, set index to the index of the byte and value to the number containing the byte value and execute aMessage. Example usage:
aFile foreach(i, v, writeln("byte at ", i, " is ", v))
aFile foreach(v, writeln("byte ", v))
For each line, set index to the line number of the line and line and execute aMessage. Example usage:
aFile foreachLine(i, v, writeln("Line ", i, ": ", v))
aFile foreach(v, writeln("Line: ", v))
Returns a Number containing the group id associated with the file's path.
Returns true if the file is at its end. Otherwise returns false.
Returns true if the receiver's path points to a directory, false otherwise.
Returns true if the receiver's path points to a link, false otherwise.
Returns self if the file is open. Otherwise returns Nil.
Returns true if the receiver is a pipe, false otherwise.
Returns true if the receiver's file descriptor is a regular file, false otherwise.
Returns true if the receiver's file descriptor is a Socket, false otherwise.
Returns true if the receiver is user group executable, false otherwise.
Returns a Date object containing the last date and time the file was accessed.
Returns a Date object containing the last date and time the file's contents were changed.
Returns a Date object containing the last date and time the file's meta info was changed.
Creates a path.lock file if it does not exist. If it does exist, it waits for it be removed by the process that created it first. Returns self.
Deprecated. The .lock file used for File locking.
Sets the file's stream to be fully
Sets the file's stream to be line buffered.
Sets the file's stream to be unbuffered.
Returns the open mode of the file(either read, update or append).
Moves the file specified by the receiver's path to the new path pathString. If a file already exists at pathString, it is silently overwritten. Raises a File error exception if the rename fails.
Returns the last path component of the file path.
Opens the file. Creates one if it does not exist. If the optionalPathString argument is provided, the path is set to it before opening. Returns self or raises an File exception on error.
Sets the file mode to append (writing to the end of the file) and calls open(optionalPathString).
Sets the file mode to read (reading only) and calls open(optionalPathString).
Sets the file mode to update (reading and writing) and calls open(optionalPathString). This will not delete the file if it already exists. Use the remove method first if you need to delete an existing file before opening a new one.
Returns a File for the directory that is the parent directory of this object's path.
Returns the file path of the receiver.
Open the file as a pipe. Return self.
Closing a popen'ed file sets exitStatus or termSignal to reflect the status or cause of the child processes' termination.
Returns the current file pointer byte position as a Number.
Sets the file position pointer to the end of the file.
Returns a Number containing the protection mode associated with the file's path.
Reads a Buffer of the specified length and returns it. Returns Nil if the end of the file has been reached.
Reads the next line of the file and returns it as a string without the return character. Returns Nil if the end of the file has been reached.
Returns list containing all lines in the file.
Reads a String of the specified length and returns it. Returns Nil if the end of the file has been reached.
Reads at most aNumber number of items and appends them to aBuffer. Returns number of items read.
Reads chunkSize bytes (4096 by default) at a time until end of file is reached. Returns a sequence containing the bytes read from the file.
Removes the file specified by the receiver's path. Raises an error if the file exists but is not removed. Returns self.
Reopens otherFile and redirects its stream to this file's path using mode. If mode is omitted, it is copied from otherFile. Returns self or raises a File exception on error.
Sets the file position pointer to the beginning of the file.
Replaces the contents for the file with aSeq. Returns self.
Sets the file path of the receiver to pathString. The default path is an empty string. Returns self.
Sets the file position pointer to the byte specified by aNumber. Returns self.
Set the buffer to be used for future stream operations.
Returns the file size in bytes.
Returns a new File whose stream is set to the standard error stream.
Returns a new File whose stream is set to the standard input stream.
Returns a new File whose stream is set to the standard output stream.
Begin streamed read to stream destination set by setStreamDestination(aBuffer).
Updates the receiver's meta info cache.
Returns the file's size in bytes as a Number.
The buffer object to be used for future stream operations.
Size of stream buffer used for streaming operations
Perform streamed reading to given buffer. The buffer will be appended with chunks of size streamReadSize until EOF. The final chunk may be less than streamReadSize.
Perform streamed reading to given buffer without yielding between reads.
Returns a new File object with an open temporary file. The file is automatically deleted when the returned File object is closed or garbage collected.
Pipe's terminating signal (after file close opened via popen).
Returns a File representing the system file in which this Io code exists.
Truncates the file's size to the numberOfBytes. Returns self.
Returns a Number containing the user id associated with the file's path.
Returns a new instance with the provided path.
Writes the arguments to the receiver file. Returns self.