A representation of file and directory pathnames.
Constructor
Creates new File object.
| Parameters |
file -
Path to file
parent -
Base path to merged with child
child -
Child path to merged with parent
|
Methods
Checks if the contents of file can be read.
Checks if the contents of file can be written.
Closes this random access file stream and releases any system resources associated
with the stream. A closed file cannot perform input or output operations.
| Throws |
IOError -
If an I/O error occurs
|
Creates the a new, empty file if and only if the file with this
name does not yeat exist.
| Returns |
true if the named file does not exist
and was successfully created; false if the named
file already exists |
| Throws |
IOError -
If an I/O error occurred
|
Checks if the file actually exists.
Returns the absolute path as file.
Returns the absolute path.
Returns the canonical path as File.
Returns the canonical path.
Returns the name of file pointed by this File instance.
Returns the path of parent file pointed by this File instance.
Returns the parent file pointed by this File instance.
Returns the path of file pointed by this File instance.
Returns the current file position.
| Throws |
IOError -
If an I/O error occurs
|
Tests if the file represented by this File object is an absolute pathname.
Checks if the file is directory.
Checks if the file is regular file.
Checks is the file is hidden.
Gets the timestamp of last modification (milliseconds
since 1.1.1970).
Return the length of file.
| Throws |
IOError -
If an I/O error occurs
|
Returns an array of strings naming the files and directories
in the directory denoted by this pathname.
Returns an array of File objects describing the files and directories
in the directory denoted by this pathname.
| Returns |
array of Files containing files and directories, or
null if this File does not point to directory. |
Creates the last part of path.
| Returns |
true if and only if the directory was created;
false otherwise |
Creates the full path.
| Returns |
true if and only if all directories was created;
false otherwise |
Opens file for reading (mode is "r") or
writing (mode is "w"). If the mode is
"rw" and it does not exists, attempt is made
to create it.
| Throws |
IOError -
If an I/O error occurs
|
Opens an input stream to file.
| Throws |
IOError -
If an I/O error occurs
|
Opens an output stream to file.
| Throws |
IOError -
If an I/O error occurs
|
| Parameters |
amout -
Amount of bytes to read
|
| Returns |
string, or int, or null if end of stream
encountered (and no bytes could not be read before it). |
| Throws |
IOError -
If an I/O error occurs
|
Reads from file to given binary.
| Parameters |
bin -
The binary into which the data is read
offset -
The start offset of the data
length -
The maximum number of bytes to read
|
| Returns |
the amount of bytes read, or -1 if there is no more
data because the end of file has been reached. |
| Throws |
IOError -
If an I/O error occurs
|
Reads and returns next serialized data from file.
| Throws |
CorruptedSerialization -
If serialized data is correupted
IOError -
If an I/O error occurs
|
Reads a single line from file.
| Returns |
line in string, or null if an error occured
or end of stream encountered (and no bytes could not be read
before it). |
| Throws |
IOError -
If an I/O error occurs
|
| Parameters |
maxLines -
Maximum number of lines to read
|
| Returns |
List of strings |
| Throws |
IOError -
If an I/O error occurs
|
Removes the file. If this pathname denotes a directory, then the
directory must be empty in order to be deleted.
| Returns |
true if and only if the file or directory is
successfully remove; false otherwise |
Requests that the file or directory denoted by this abstract
pathname be deleted when the virtual machine terminates.
Renames the file.
| Returns |
true if and only if the renaming succeeded;
false otherwise |
Seeks file pointer to new position.
| Parameters |
pos -
the offset position, measured in bytes
from the beginning of the file,
|
| Throws |
IOError -
If an I/O error occurs
|
Sets last modification timestamp.
Sets the length of file to 'newLength'. If 'newLength' is greater
than the current length, contents of extended section is undefined.
| Throws |
IOError -
If an I/O error occurs
|
Sets the file readonly.
Skips given amount of bytes.
| Parameters |
amount -
Amount of bytes to skip
|
| Returns |
number of bytes skipped. |
| Throws |
IOError -
If an I/O error occurs
|
Attempts to synchronize the changes back to disk.
| Throws |
IOError -
If an I/O error occurs
|
Converts path on this File variable to file:// URL.
| Throws |
IOError -
If an I/O error occurs
|
Writes the contents of binary to file.
| Parameters |
bin -
The binary from which the data is written
offset -
The start offset of the data
length -
The number of bytes to write
|
| Throws |
IOError -
If an I/O error occurs
|
Serializes parameters to file.
| Parameters |
data -
Data to serialize
|
| Throws |
IOError -
If an I/O error occurs
|
Operators
iterator * InstanceOfFile
If this file points directory, return iterator
of files in directory, otherwise returns iterator
of lines in file.