Represents an entry, which is a file or a directory in an nb.fs.NFileSystem.

Available since

0.1.0

.

Variables

@:value(-1)read onlymTime:Float = -1

The last time the entry was modified on storage.

Methods

exists(path:String):Bool

Checks whether an entry exists.

Warning : Doesn't understand "../" in path yet. // todo

Parameters:

path

The entry's path relative to this instance's path.

Returns:

true if it exists, false otherwise.

getBytes():Bytes

Loads the entry if it is a file, then returns bytes.

iterator():ArrayIterator_hxd_fs_FileEntry

Returns an iterator of all the entries in this entry's associated directory.

load(?onReady:() ‑> Void):Void

Loads a file into memory. The file is loaded asynchronously if the target is javascript or supports threads.

The associated data file will be loaded if it wasn't already loaded.

Throws an error if the entry is not a file.

Parameters:

onReady

Called when the file finishes loading.

readBytes(out:Bytes, outPos:Int, pos:Int, len:Int):Int

Copies the entry's bytes and stores it into a given haxe.io.Bytes. If the entry is a directory, nothing is copied.

Parameters:

out

An haxe.io.Bytes instance to store the bytes read.

outPos

The position in out from where to start writing bytes.

pos

The position in this instance's bytes from where to start copying.

len

Number of bytes to be copied.

Returns:

len, or 0 if the entry is a directory.

unload():Bool

Unloads a file.

Keep in mind that as long as the file's bytes is still referenced somewhere, then it's still in memory. This function only stops the file system from referencing it so that it gets garbage collected.

Returns:

true if a loaded file was unloaded, false otherwise.

watch(onChanged:Null<() ‑> Void>):Void

Sets a callback for whenever the file changes.

It must also be added to the associated NFileSystem's watchedFiles to trigger, which by default is done automatically when the file is loaded into memory.

Inherited Variables

Defined by FileEntry

read onlydirectory:String

read onlyextension:String

read onlyisAvailable:Bool

read onlyisDirectory:Bool

read onlyname:String

read onlypath:String

read onlysize:Int

Inherited Methods

Defined by FileEntry

fetchBytes(pos:Int, len:Int):Bytes

Similar to readBytes except : a) a temporary buffer is reused, meaning a single fetchBytes must occur at a single time b) it will throw an Eof exception if the data is not available

getSign():Int

Read first 4 bytes of the file.

loadBitmap(onLoaded:LoadedBitmap ‑> Void):Void

readFull(bytes:Bytes, pos:Int, len:Int):Void