Overview | File | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class File

    Object
       |
       +--File

class File

Class implementing basic support for files
Defined in file.js

Field Summary
`Object` | `name`

Constructor Summary
`File(<String> name)` Create a reference to a file system object (file or directory)

Method Summary
`void` | `close()` Close streams associated with file
`String` | `getAbsolutePath(<Number> mode)` Return absolute path
`File` | `getParentFile()` Return the parent file of this file object
`String[]` | `list()` Return list of files contained in the directory referenced by the File object
`ByteString` | `readAllAsBinary()` Read complete file into ByteString object
`String` | `readAllAsString(encoding)` Read complete file into String object
`void` | `writeAll(<Object> obj, encoding)` Write the object to file
`<static> void` | `test()`

Field Detail

### name

    Object name

Constructor Detail

### File

    File(<String> name)

Create a reference to a file system object (file or directory)

Parameters:

`name` - relative or absolute file path

Method Detail

### close

    void close()

Close streams associated with file

### getAbsolutePath

    String getAbsolutePath(<Number> mode)

Return absolute path

Parameters:

`mode` - one of GPSystem.AUTO, GPSystem.CWD, GPSystem.USR or GPSystem.SYS. See GPSystem.mapFilename() for details

Returns:

the absolute path

### getParentFile

    File getParentFile()

Return the parent file of this file object

Returns:

the parent file object or null

### list

    String[] list()

Return list of files contained in the directory referenced by the File object

Returns:

the list of file names

### readAllAsBinary

    ByteString readAllAsBinary()

Read complete file into ByteString object

Returns:

the binary content

### readAllAsString

    String readAllAsString(encoding)

Read complete file into String object

Returns:

the text content

### writeAll

    void writeAll(<Object> obj, encoding)

Write the object to file

Parameters:

`obj` - to write to file (Using toString() for any other than String and ByteString)

`one` - of UTF8 or ASCII (Default is UTF8)

### test

    <static> void test()

Overview | File | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Documentation generated by JSDoc on Thu Jun 25 17:01:35 2026