#include <file_utilities.h>
Public Types | |
| using | WriteDirectoryFilterDelegate = Delegate< Bool(const Url &url)> |
| using | ReadDirectoryTreeReceiver = ValueReceiver< const Block< const String > &, Int64, const DataDictionary & > |
| using | DirectoryTree = TreeMap< String, Int > |
Private Member Functions | |
| MAXON_INTERFACE_NONVIRTUAL (FileUtilities, MAXON_REFERENCE_STATIC, "net.maxon.interface.fileutilities", MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel")) | |
| using WriteDirectoryFilterDelegate = Delegate<Bool(const Url& url)> |
return true to add file to index, false to ignore in index
| using ReadDirectoryTreeReceiver = ValueReceiver<const Block<const String>&, Int64, const DataDictionary&> |
receives (relative file path, file size, extra attributes for Url), negative file size indicates directory
| using DirectoryTree = TreeMap<String, Int> |
describes a directory hierarchy, the Int value is the file size. For directories the TreeMap nodes have no value.
|
private |
|
static |
Reads a file into memory.
| [in] | name | Name or Stream of the file. |
| [out] | arr | Array holding the memory, will be initialized inside. |
|
static |
Reads a file into memory. If an UTF encoding is detected the proper decoding takes place.
| [in] | url | Name or Stream of the file. |
| [out] | arr | Array holding the memory, will be initialized inside. |
| [in] | defaultDecoding | The character decoding that will be used if the file does not contain any Byte Order Mark (BOM). |
|
static |
Writes a Utf32Char array from memory to disc in a UTF-encoded format.
| [in] | url | The file to be written. |
| [in] | arr | Array holding the data. |
| [in] | encoding | The character encoding to be used. |
| [in] | dontWriteHeader | If true the utf8 header will not be written. |
|
static |
Compares the content of 2 files for binary equality.
| [in] | file1 | Name or Stream of the file 1. |
| [in] | file2 | Name or Stream of the file 2. |
|
static |
Reads stream directly into an array.
| [in] | url | Path to stream. |
| [out] | dest | BaseArray where the data is stored. |
|
static |
Copies all bytes from #from to #to. This function reads bytes as long as possible. It doesn't call the Close() method on #from or #to.
| [in] | from | The stream from which the bytes shall be read. |
| [in] | to | The stream to which the bytes shall be written. |
|
static |
Copies all bytes from #from to #to. This function reads bytes as long as possible. It doesn't call the Close() method on #from or #to.
| [in] | from | The stream from which the bytes shall be read. |
| [in] | to | The stream to which the bytes shall be written. |
| [in] | progress | Progress delegate which is called to notify about the progress. |
|
static |
Copies the file or directory #from to #to. If it doesn't already exist, a file or directory is created for the Url #to. For a file its content is copied, for a directory a recursive copy happens. Symbolic links are skipped.
|
static |
Copies the file or directory #from into an archive #archive/#to. If it doesn't already exist, a file or directory is created for the Url #to. For a file its content is copied, for a directory a recursive copy happens. Symbolic links are skipped.
| [in] | from | The source Url. |
| [in] | to | The relative destination Url in the archive. |
| [in] | archive | Archive to write to. |
|
static |
Adds the structure of the directory tree starting at root to the given #tree. Exising entries in #tree will be kept.
| [in] | root | The Url to start. |
| [in] | filterDelegate | An optional delegate to filter which files/directories shall be added. |
| [out] | tree | The structure is added to this tree. Existing entries will be kept. |
| [in] | checkCancellation | True if an error shall be returned when the current job has been cancelled. |
|
static |
Writes the given directory tree to out in a human-readable text format. ReadDirectoryTree can be used to read that format.
| [in] | tree | The tree to write. |
| [in] | out | Where to write the file. |
| [in] | sort | True if the tree shall be written in a sorted way, false otherwise. |
| [in] | checkCancellation | True if an error shall be returned when the current job has been cancelled. |
|
static |
Writes the structure of the directory starting at root to out in a human-readable text format. ReadDirectoryTree can be used to read that format. This method will check for job cancellation and return an OperationCancelledError in that case.
| [in] | root | The Url to start. |
| [in] | out | Where to write the file. |
| [in] | filterDelegate | An optional delegate to filter which files/directories shall be added. |
|
static |
Reads a file which has been written by WriteDirectoryTree and passes its content to receiver.
| [in] | in | The Url of the file to read. |
| [in] | receiver | The content of the file is passed to this receiver. |
|
static |
Creates an output stream which writes to the given CString. Whenever bytes are written to the stream, these will be appended to str.
| [out] | str | The string to write to. You have to keep the object alive as long as the stream is in use. Previously existing content of str is kept. |
| [in] | maxLength | The maximum length of the string. When this limit is exceeded, no further characters will be appended. |
|
static |
Creates an output stream which just discards any bytes written to it without reporting errors (similar to the null device of operating systems, e.g. {/dev/null}).
|
static |
|
static |
|
static |