Class representing an open file. Some methods in this class are instance variants of the same methods in nusys.FileSystem.

Variables

read onlyasync:AsyncFile

Methods

chown (uid:Int, gid:Int):Void

close ():Void

Closes the file. Any operation after this method is called is invalid.

datasync ():Void

Same as sync, but metadata is not flushed unless needed for subsequent data reads to be correct. E.g. changes to the modification times are not flushed, but changes to the filesize do.

readBuffer (buffer:Bytes, offset:Int, length:Int, position:Int):{bytesRead:Int, buffer:Bytes}

Reads a part of this file into the given buffer.

Parameters:

buffer

Buffer to which data will be written.

offset

Position in buffer at which to start writing.

length

Number of bytes to read from this file.

position

Position in this file at which to start reading.

readFile ():Bytes

Reads the entire contents of this file.

stat ():FileStat

Available on cross

stat ():Stat

Available on eval

sync ():Void

Flushes all modified data and metadata of this file to the disk.

@:value({ len : 0 })truncate (len:Int = 0):Void

utimes (atime:Date, mtime:Date):Void

writeBuffer (buffer:Bytes, offset:Int, length:Int, position:Int):{bytesWritten:Int, buffer:Bytes}

Writes a part of the given buffer into this file.

Parameters:

buffer

Buffer from which data will be read.

offset

Position in buffer at which to start reading.

length

Number of bytes to write to this file.

position

Position in this file at which to start writing.

writeString (str:String, ?position:Int, ?encoding:Encoding):{bytesWritten:Int, buffer:Bytes}

Writes a string to this file at position.

Static methods

@:value({ binary : true })staticinlineappend (path:String, binary:Bool = true):FileOutput

Deprecated: "use sys.FileSystem.appendFile instead"

staticinlinecopy (srcPath:String, dstPath:String):Void

Deprecated: "use sys.FileSystem.copy instead"

staticinlinegetBytes (path:String):Bytes

Deprecated: "use sys.FileSystem.readFile instead"

staticinlinegetContent (path:String):String

Deprecated: "use sys.FileSystem.readFile instead"

@:value({ binary : true })staticinlineread (path:String, binary:Bool = true):FileInput

Deprecated: "use sys.FileSystem.open instead"

staticinlinesaveBytes (path:String, bytes:Bytes):Void

Deprecated: "use sys.FileSystem.writeFile instead"

staticinlinesaveContent (path:String, content:String):Void

Deprecated: "use sys.FileSystem.writeFile instead"

@:value({ binary : true })staticinlineupdate (path:String, binary:Bool = true):FileOutput

Deprecated: "use sys.FileSystem.open instead"

@:value({ binary : true })staticinlinewrite (path:String, binary:Bool = true):FileOutput

Deprecated: "use sys.FileSystem.open instead"