Class File
Class implementing basic support for files
Defined in: File.js.
Constructor Attributes | Constructor Name and Description |
---|---|
File(name, location)
Create a reference to a file system object (file or directory)
|
Method Attributes | Method Name and Description |
---|---|
close()
Close streams associated with file
|
|
exists()
Return true if file exists
|
|
getAbsolutePath(mode)
Return absolute path
|
|
Return the parent file of this file object
|
|
list()
Return list of files contained in the directory referenced by the File object
|
|
Read complete file into ByteString object
|
|
readAllAsString(encoding)
Read complete file into String object
|
|
writeAll(obj, encoding)
Write the object to file
|
Class Detail
File(name, location)
Create a reference to a file system object (file or directory)
- Parameters:
- {String} name
- relative or absolute file path
- {Number} location
- one of GPSystem.CWD, GPSystem.USR, GPSystem.SYS, GPSystem.AUTO to resolve relative names. Default GPSystem.CWD
Method Detail
close()
Close streams associated with file
exists()
Return true if file exists
{String}
getAbsolutePath(mode)
Return absolute path
- Parameters:
- mode
- Returns:
- the absolute path
{File}
getParentFile()
Return the parent file of this file object
- Returns:
- the parent file object or null
{String[]}
list()
Return list of files contained in the directory referenced by the File object
- Returns:
- the list of file names
{ByteString}
readAllAsBinary()
Read complete file into ByteString object
- Returns:
- the binary content
{String}
readAllAsString(encoding)
Read complete file into String object
- Parameters:
- encoding
- Returns:
- the text content
writeAll(obj, encoding)
Write the object to file
- Parameters:
- obj
- encoding