Class Index | File Index

Classes


Class File

Class implementing basic support for files
Defined in: File.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
File(name, location)
Create a reference to a file system object (file or directory)
Method Summary
Method Attributes Method Name and Description
 
Close streams associated with file
 
Return true if file exists
 
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

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Feb 16 2024 18:38:12 GMT+0100 (CET)