Skip to content
Hyomoto edited this page Dec 12, 2020 · 16 revisions
Jump To Go Back Arguments Methods Variables

File( read_only )

Implements: GenericOutput

A generic file handling interface, should be inherited by new file types to ensure compatibility with FAST file handling functions.

 var _file = new File();

 _file.write( "Hello World!" );

Arguments

Name Type Purpose
read_only bool optional: whether or not this file should be written to, default: false

Methods

Jump To top reset size exists read peek poke write remaining eof
save close discard clear is toArray toString

reset()

Returns: N/A undefined

Name Type Purpose
None

Resets the read position of the file back to the start.


size()

Returns: inp

Name Type Purpose
None

Returns the "size" of the file. Context relies on the type of file.


exists()

Returns: boolean (true or false)

Name Type Purpose
None

Returns true if the source file exists.


read()

Returns: mixed, or undefined

Name Type Purpose
None

Advances the position in the file and returns the next piece of it, or undefined if the end of file has been reached.


peek( _index )

Returns: mixed, or undefined

Name Type Purpose
_index undef none provided

Returns the data located in the file a the given index, or undefined if it doesn't exist.


poke( _index, _value )

Returns: N/A undefined

Name Type Purpose
_index undef none provided
_value undef none provided

Inserts the given value into the file at the given index.


write( _value )

Returns: mixed

Name Type Purpose
_value undef none provided

Writes the given value to the end of the file.


remaining()

Returns: inp

Name Type Purpose
None

Returns how many more reads() until the end of file.


eof()

Returns: boolean (true or false)

Name Type Purpose
None

Returns whether or not the end of the file has been reached.


save()

Returns: boolean (true or false)

Name Type Purpose
None

Returns true if file is writable, otherwise logs a file handling error. Inheritable by child structs to check if the file is wirtable.


close()

Returns: N/A undefined

Name Type Purpose
None

Saves and cleans up the internal structures so the File can be garbage-collected safely.


discard()

Returns: N/A undefined

Name Type Purpose
None

Cleans up the internal structures so the File can be garbage-collected safely.


clear()

Returns: N/A undefined

Name Type Purpose
None

Clears the file, thus making it "empty".


is( type )

Returns: boolean (true or false)

Name Type Purpose
type Constructor The Constructor to compare this against.

Returns true if the provided type is File.


toArray()

Returns: array ([values...])

Name Type Purpose
None

Returns the structure as a array.


toString()

Returns: string ("string")

Name Type Purpose
None

Returns the structure as a string.


Variables

Jump To top
  • writable - none provided
  • contents - none provided
  • next - none provided
  • saveIndex - none provided
Clone this wiki locally