# sys::File

    sys::Obj
      sys::File

`public final class File`

File is used to manage I/O to a "file". A Sedona VM may support multiple file backing storage devices via FileStore subclasses.

fp

  `public Obj fp`

in

  `public inline InStream in`

name

  `public Str name`

out

  `public inline OutStream out`

store

  `public FileStore store`

File

  `public void File()`

  File constructor.

close

  `public bool close()`

  Close this file. Return true on success or false on failure.

exists

  `public bool exists()`

  Return if the file identified by name exists on the file system. This method may used without opening the file.

open

  `public bool open(Str mode)`

  Open the file using the configured name field. Mode is a string how IO will be performed:

        - "r": open for reading
        - "w": open for writing (truncate existing)
        - "m": open for modification and read/writing (don't truncate)

  Return true on success or false on error.

  Note although the mode strings are passed as simply "r", "w", or "m", it is expected that files are always opened for binary IO - for example "w" maps to the C fopen mode of "wb".

seek

  `public bool seek(int pos)`

  Seek to a specific byte offset position in the file. Return true on success or false on failure. A failure typically indicates a seek past the file limit of the device's "file system". Use tell to read the current position.

size

  `public int size()`

  Return the size in bytes of the file, or -1 if the file does not exist or cannot currently be accessed (e.g. if open for writing). This method may used without opening the file.

tell

  `public int tell()`

  Return the current byte offset position of the file. Use seek to change the current position. Returns -1 on an error.