(class)
public LocalFile
{inherits
File}
A File that exists in the local filesystem.
| constructor
public
| {LocalFile.clone-from from:LocalFile} |
| exists?: | Indicates whether the file represented by self actually exists in the underlying filesystem. |
accessor public LocalFile.exists?:
bool
| readable?: | Indicates whether the object represented by self can be opened for reading. |
accessor public LocalFile.readable?:
bool
| url: | The name of this file. |
accessor public final inline LocalFile.url:
Url
accessor public LocalFile.when-last-accessed:#
DateTime
accessor public LocalFile.when-last-modified:#
DateTime
| writable?: | Indicates whether the file represented by self can be opened for writing. |
accessor public LocalFile.writable?:
bool
|
public
| {LocalFile.append-open create?:bool = true, create-mode:int = 0o666, character-encoding:CharEncoding = CharEncoding.none-specified, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
} }:TextOutputStream |
|
public
| {LocalFile.append-open-byte create?:bool = true, create-mode:int = 0o666, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
} }:ByteOutputStream |
|
public
| {LocalFile.async-read-open character-encoding:CharEncoding = CharEncoding.none-specified, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, char
}, unread-size:int = {min 4, buffer-size div 4}, event-handler:EventHandler, ...:EventHandler }:AsyncFileOpener |
|
public
| {LocalFile.async-read-open-byte buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
}, unread-size:int = {min 4, buffer-size div 4}, event-handler:EventHandler, ...:EventHandler }:AsyncFileOpener |
| clone: | Returns a shallow copy of self. |
| info: | Returns a LocalFileInfo object, which lets you access more information about the File. |
|
public
| {LocalFile.read-open character-encoding:CharEncoding = CharEncoding.none-specified, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, char
}, unread-size:int = {min 4, buffer-size div 4} }:TextInputStream |
|
public
| {LocalFile.read-open-byte buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
}, unread-size:int = {min 4, buffer-size div 4} }:ByteInputStream |
|
public
| {LocalFile.write-open create?:bool = true, create-mode:int = 0o666, error-if-exists?:bool = false, truncate-if-exists?:bool = true, character-encoding:CharEncoding = CharEncoding.none-specified, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
} }:TextOutputStream |
|
public
| {LocalFile.write-open-byte create?:bool = true, create-mode:int = 0o666, error-if-exists?:bool = false, truncate-if-exists?:bool = true, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
} }:ByteOutputStream |
(constructor)
Initialize a LocalFile.
from: self's name is copied from from.
(accessor)
accessor public LocalFile.exists?:
bool Indicates whether the file represented by self actually exists in the underlying filesystem.
Returns
A bool indicating whether the file exists or not.
Description
The returned value is not a guarantee that any future action on self will succeed or fail in any particular way. Many factors (including race conditions, permission issues, and platform limitations) prevent perfect accuracy. In addition the implementation may choose to improve performance by reducing the accuracy of the result.
(accessor)
accessor public LocalFile.readable?:
bool Indicates whether the object represented by self can be opened for reading.
Returns
A bool indicating whether the object is readable or not.
Description
The returned value is not a guarantee that any future action on self will succeed or fail in any particular way. Many factors (including race conditions, permission issues, and platform limitations) prevent perfect accuracy. In addition the implementation may choose to improve performance by reducing the accuracy of the result.
(accessor)
accessor public final inline LocalFile.url:
Url
(accessor)
accessor public LocalFile.when-last-accessed:#
DateTime Returns when last accessed, if applicable, otherwise null.
(accessor)
accessor public LocalFile.when-last-modified:#
DateTime Returns when last modified, if applicable, otherwise null.
(accessor)
accessor public LocalFile.writable?:
bool Indicates whether the file represented by self can be opened for writing.
Returns
A bool indicating whether the file is writable or not.
Description
The returned value is not a guarantee that any future action on self will succeed or fail in any particular way. Many factors (including race conditions, permission issues, and platform limitations) prevent perfect accuracy. In addition the implementation may choose to improve performance by reducing the accuracy of the result.
(method)
| public
| {LocalFile.append-open create?:bool = true, create-mode:int = 0o666, character-encoding:CharEncoding = CharEncoding.none-specified, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
} }:TextOutputStream |
Open self for appending.
create?: When true (default), indicates that the underlying file should be created if it doesn't already exist.
create-mode: Indicates the permissions that the file should have, if created. Currently, on UNIX systems, this argument is simply passed directly through to open() and mkdir() calls. On UNIX systems, create-mode is modified by the umask to get the resulting file protection.
character-encoding: Indicates the character encoding to use when writing to the file. See
CharEncoding. When unspecified, the character encoding is determined as in
File.read-open.
buffer-size: Minimum number of chars to be buffered. If buffer-size is 0, tries to make an unbuffered stream if possible.
Returns
Notes
Usually, trying to seek on the
TextOutputStream that this method returns will fail.
Notes
(method)
| public
| {LocalFile.append-open-byte create?:bool = true, create-mode:int = 0o666, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
} }:ByteOutputStream |
Open self for byte-stream appending.
create?: When true (default), indicates that the underlying file should be created if it doesn't already exist.
create-mode: Indicates the permissions that the file should have, if created. Currently, on UNIX systems, this argument is simply passed directly through to open() and mkdir() calls. On UNIX systems, create-mode is modified by the umask to get the resulting file protection.
buffer-size: Minimum number of
chars to be buffered. If
buffer-size is
0, tries to make an unbuffered stream if possible; if not
0, a
BufferedByteOutputStream will be returned.
Returns
Notes
Usually, trying to seek on the
ByteOutputStream that this method returns will fail.
(method)
| public
| {LocalFile.async-read-open character-encoding:CharEncoding = CharEncoding.none-specified, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, char
}, unread-size:int = {min 4, buffer-size div 4}, event-handler:EventHandler, ...:EventHandler }:AsyncFileOpener |
Asynchronously opens self for text input, and calls the provided event handlers with an AsyncFileOpenEvent that contains either an exception or the TextInputStream that was opened in it.
character-encoding: Indicates the character encoding to use when reading from the file. See
CharEncoding. If unspecified, the character encoding is interpreted, if possible, from the first few bytes in the stream. When this is not possible, the default character encoding,
CharEncoding.utf8, is used.
buffer-size: Minimum number of chars to be buffered. If buffer-size and unread-size are both 0, tries to make an unbuffered stream if possible.
unread-size: Minimum number of chars to be efficiently unreadable. If buffer-size and unread-size are both 0, tries to make an unbuffered stream if possible.
Returns
(method)
| public
| {LocalFile.async-read-open-byte buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
}, unread-size:int = {min 4, buffer-size div 4}, event-handler:EventHandler, ...:EventHandler }:AsyncFileOpener |
Asynchronously opens self for byte input, and calls the provided event handlers with an AsyncFileOpenEvent that contains either an exception or the ByteInputStream that was opened in it.
buffer-size: Minimum number of
chars to be buffered. If
buffer-size and
unread-size are both
0, tries to make an unbuffered stream if possible; if either is not
0, a
BufferedByteInputStream will be made.
unread-size: Minimum number of
chars to be efficiently unreadable. If
buffer-size and
unread-size are both
0, tries to make an unbuffered stream if possible; if either is not
0, a
BufferedByteInputStream will be made.
Returns
(method)
Returns a shallow copy of self.
(method)
Returns a LocalFileInfo object, which lets you access more information about the File.
snap-symlink?: If
true, resolves symbolic links in the file's path before creating the
LocalFileInfo object.
error-if-missing?: If
true, results in a
MissingFileException being thrown if the
File object does not represent a file that exists in the filesystem.
(method)
| public
| {LocalFile.read-open character-encoding:CharEncoding = CharEncoding.none-specified, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, char
}, unread-size:int = {min 4, buffer-size div 4} }:TextInputStream |
Open self for input.
character-encoding: Indicates the character encoding to use when reading from the file. See
CharEncoding. If unspecified, the character encoding is interpreted, if possible, from the first few bytes in the stream. When this is not possible, the default character encoding,
CharEncoding.utf8, is used.
buffer-size: Minimum number of chars to be buffered. If buffer-size and unread-size are both 0, tries to make an unbuffered stream if possible.
unread-size: Minimum number of chars to be efficiently unreadable. If buffer-size and unread-size are both 0, tries to make an unbuffered stream if possible.
Returns
Notes
(method)
| public
| {LocalFile.read-open-byte buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
}, unread-size:int = {min 4, buffer-size div 4} }:ByteInputStream |
Open self for byte-stream input.
buffer-size: Minimum number of
chars to be buffered. If
buffer-size and
unread-size are both
0, tries to make an unbuffered stream if possible; if either is not
0, a
BufferedByteInputStream will be returned.
unread-size: Minimum number of
chars to be efficiently unreadable. If
buffer-size and
unread-size are both
0, tries to make an unbuffered stream if possible; if either is not
0, a
BufferedByteInputStream will be returned.
Returns
(method)
| public
| {LocalFile.write-open create?:bool = true, create-mode:int = 0o666, error-if-exists?:bool = false, truncate-if-exists?:bool = true, character-encoding:CharEncoding = CharEncoding.none-specified, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
} }:TextOutputStream |
Open self for output.
create?: When true (default), indicates that the underlying file should be created if it doesn't already exist.
create-mode: Indicates the permissions that the file should have, if created. Currently, on UNIX systems, this argument is simply passed directly through to open() and mkdir() calls. On UNIX systems, create-mode is modified by the umask to get the resulting file protection.
error-if-exists?: When
true, causes this method to throw an
ExistingFileException if the file being opened already exists.
truncate-if-exists?: When true (default), indicates that the underlying file should be truncated if it already exists. When false, data will be written to the file from the current location, without truncating the file. The initial location is always the start of the file.
character-encoding: Indicates the character encoding to use when writing to the file. See
CharEncoding. If unspecified, the default character encoding,
CharEncoding.utf8, is used.
buffer-size: Minimum number of chars to be buffered. If buffer-size and unread-size are both 0, tries to make an unbuffered stream if possible.
Returns
Notes
create? = false and error-if-exists? = true don't make any sense together.
Notes
Notes
(method)
| public
| {LocalFile.write-open-byte create?:bool = true, create-mode:int = 0o666, error-if-exists?:bool = false, truncate-if-exists?:bool = true, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, byte
} }:ByteOutputStream |
Open self for byte-stream output.
create?: When true (default), indicates that the underlying file should be created if it doesn't already exist.
create-mode: Indicates the permissions that the file should have, if created. Currently, on UNIX systems, this argument is simply passed directly through to open() and mkdir() calls. On UNIX systems, create-mode is modified by the umask to get the resulting file protection.
error-if-exists?: When
true, causes this method to throw an
ExistingFileException if the file being opened already exists.
truncate-if-exists?: When true (defaults), indicates that the underlying file should be truncated if it already exists. When false, data will be written to the file from the current location, without truncating the file. The initial location is always the start of the file.
buffer-size: Minimum number of
chars to be buffered. If
buffer-size and
unread-size are both
0, tries to make an unbuffered stream if possible; if either is not
0, a
BufferedByteOutputStream will be returned.
Returns
Notes
create?=false and error-if-exists?=true don't make any sense together.
Notes