FileSync class
Provides a set of methods to read/write a file synchronisly.
The class is mostly used internally.
Note: the api to this class is considered EXPERIMENTAL and is subject to change.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
Returns the length of the file in bytes
The file does NOT have to be open
to determine its length.
See:
no setter
- path → String
-
The path to this file.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
append(
String line, {String? newline}) → void -
Appends the
lineto the file Appendsnewlineafter the line. Ifnewlineis null or isn't passed then the platform end of line characters are appended as defined byPlatform().eol. Pass null or an '' tonewlineto not add a line terminator. -
close(
) → void - Close and flushes the file to disk.
-
flush(
) → void - Flushes the contents of the file to disk.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
CancelableLineAction lineAction) → void -
reads every line from a file calling the passed
lineActionfor each line. if you return false from alineActioncall then the read returns and no more lines are read. -
readIntoSync(
List< int> buffer, [int start = 0, int? end]) → int -
Exposed the RandomFileAccess method readIntoSync
Synchronously reads into an existing
buffer. -
readLine(
{String? lineDelimiter}) → String? -
Reads a single line from the file.
lineDelimiterthe end of line delimiter. -
resolveSymLink(
) → String - This is just a wrapper for the method File.resolveSymbolicLinksSync. Returns the path the symbolic link links to.
-
toString(
) → String -
A string representation of this object.
inherited
-
truncate(
) → void - Truncates the file to zero bytes in length.
-
write(
String line, {String? newline}) → void -
Truncates the file to zero bytes and
then writes the given text to the file.
If
newlineis null or isn't passed then the platform end of line characters are appended as defined byPlatform().eol. Pass null or an '' tonewlineto not add a line terminator. -
writeFromSync(
List< int> buffer, [int start = 0, int? end]) → void - Exposed the RandomFileAccess method writeFromSync.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited