shadow:io@CanRead, shadow:io@CanWrite, shadow:io@CanOpen, shadow:io@CanClose
class File
Class File provides utilities for interacting with a file in the operating system, such as creating a new file, deleting an existing file, reading from a file, and writing to a file.
| Modifiers | Return Types | Method and Description |
|---|---|---|
public |
() |
create(Path path)Creates a |
public |
() |
create(String path)Creates a |
| Modifiers | Return Types | Method and Description |
|---|---|---|
public |
() |
destroy()Closes the |
| Modifiers | Return Types | Method and Description |
|---|---|---|
public |
() |
close()Closes the file. |
public readonly |
(File) |
copy(AddressMap addresses) |
public |
(File) |
delete() |
public |
() |
open()Opens or creates a file in the operating system with the path of this |
public |
() |
open(int mode)Opens or creates a file in the operating system with the path of this |
public readonly |
(long) |
read(ubyte[] buffer)Reads data from the file into the buffer and updates the read pointer location. |
public readonly |
(String) |
toString()Returns a |
public |
(long) |
write(readonly ubyte[] buffer, long bytes)Writes data from the buffer into the file and updates the write pointer location. |
| Modifiers | Return Types | Method and Description |
|---|---|---|
public readonly get |
(boolean) |
exists()Determines a file in the operating system matches the path in this |
public get |
(boolean) |
isOpen()Gets whether the file is open. |
public readonly get |
(Path) |
path() |
public readonly get |
(long) |
position()Gets the current position of the read/write pointer inside the file. |
public set |
() |
position(long position)Sets the current position of the read/write pointer inside the file. |
public readonly get |
(long) |
size()Gets the size of the file in bytes. |
public set |
() |
size(long size)Sets the size of the file in bytes, extending or truncating it. |
public create(Path path) => ()
Creates a File object associated with the file specified by the given Path object.
path - of the file
public create(String path) => ()
Creates a File object associated with the file on the given path.
path - of the file
public destroy() => ()
Closes the File on destroy.
public close() => ()
Closes the file.
public readonly copy(AddressMap addresses) => (File)
public delete() => (File)
public open() => ()
Opens or creates a file in the operating system with the path of this File object.
public open(int mode) => ()
Opens or creates a file in the operating system with the path of this File object.
public readonly read(ubyte[] buffer) => (long)
Reads data from the file into the buffer and updates the read pointer location.
buffer - array of byte values to hold file data
number of byte values successfully read, always less than or equal the length of the buffer, or -1 if end of file has been reached
public readonly toString() => (String)
Returns a String representation of the path of this file.
public readonly get exists() => (boolean)
Determines a file in the operating system matches the path in this File object.
true if the file exists
public get isOpen() => (boolean)
Gets whether the file is open. This method does not distinguish between open for reading and open for writing.
public readonly get path() => (Path)
public readonly get position() => (long)
Gets the current position of the read/write pointer inside the file.
position in file
public set position(long position) => ()
Sets the current position of the read/write pointer inside the file.
position - in file
public set size(long size) => ()
Sets the size of the file in bytes, extending or truncating it.
new - file size