Skip to content

FileStream

FileStream is a class used for file I/O operations. The FileStream class allows for reading, writing, truncating, and appending operations on files.

构造方法

FileStream.new ( path : string , mode : FileMode , access : FileAccess? )
Create a file stream.

成员变量

FileStream.pos : number
(Read-only) Returns the current read position of the stream.
FileStream.length : number
(Read-only) Returns the length of the current stream.

成员方法

FileStream.WriteBytes ( stream : MemoryStream ) : void
Writes the byte data of the specified memory stream to the current stream.
FileStream.Flush ( ) : void
Clears the buffer of this file stream and writes all buffered data to the disk.
FileStream.Seek ( offset : number , dir : FileDirection? ) : void
Sets the position of the stream to the specified location.
FileStream.ReadBytes ( stream : MemoryStream , count : number? ) : void
Reads the specified number of bytes from the current stream and stores them in the target memory stream.
FileStream.ReadAllString ( ) : string
Reads and returns all characters from a file stream.
FileStream.Close ( ) : void
Closes the current stream and releases any resources associated with it.
FileStream.WriteAllString ( val : string ) : void
Writes the contents of the specified string to a file stream.