FileUtilities Class Reference

#include <file_utilities.h>

静态公共成员函数

static MAXON_METHOD Result < void >  ReadFileToMemory ( UrlOrInputStream &&name, WritableArrayInterface < Char > &arr)
static MAXON_METHOD Result < void >  ReadUtfFile ( UrlOrInputStream &&url, WritableArrayInterface < Utf32Char > &arr, UTFTEXT_OPTIONS::TEXTENCODING defaultDecoding= UTFTEXT_OPTIONS::TEXTENCODING::UTF8 )
static MAXON_METHOD Result < void >  WriteUtfFile (const Url &url, const ArrayInterface < Utf32Char > &arr, UTFTEXT_OPTIONS::TEXTENCODING encoding= UTFTEXT_OPTIONS::TEXTENCODING::UTF8 , Bool dontWriteHeader=false)
static MAXON_METHOD Result < void >  CompareFiles ( UrlOrInputStream &&file1, UrlOrInputStream &&file2)
template<typename T >
static Result < void >  ReadToArray ( UrlOrInputStream &&url, BaseArray < T > &dest)
static MAXON_METHOD Result < void >  CopyStream (const InputStreamRef &from, const OutputStreamRef &to)
static MAXON_METHOD Result < void >  CopyFileOrDirectory (const Url &from, const Url &to)
static MAXON_METHOD Result < void >  CopyFileOrDirectory (const Url &from, const String &to, const WriteArchiveRef &archive)

私有成员函数

  MAXON_INTERFACE_NONVIRTUAL ( FileUtilities , MAXON_REFERENCE_NONE , "net.maxon.interface.fileutilities")

成员函数文档编制

◆  MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( FileUtilities   ,
MAXON_REFERENCE_NONE   ,
"net.maxon.interface.fileutilities"   
)
private

◆  ReadFileToMemory()

static MAXON_METHOD Result <void> ReadFileToMemory ( UrlOrInputStream &&  name ,
WritableArrayInterface < Char > &  arr  
)
static

Reads a file into memory.

参数
[in] name Name or Stream of the file.
[out] arr Array holding the memory, will be initialized inside.
返回
OK on success.

◆  ReadUtfFile()

static MAXON_METHOD Result <void> ReadUtfFile ( UrlOrInputStream &&  url ,
WritableArrayInterface < Utf32Char > &  arr ,
UTFTEXT_OPTIONS::TEXTENCODING   defaultDecoding = UTFTEXT_OPTIONS::TEXTENCODING::UTF8  
)
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).
返回
OK on success.

◆  WriteUtfFile()

static MAXON_METHOD Result <void> WriteUtfFile ( const Url url ,
const ArrayInterface < Utf32Char > &  arr ,
UTFTEXT_OPTIONS::TEXTENCODING   encoding = UTFTEXT_OPTIONS::TEXTENCODING::UTF8 ,
Bool   dontWriteHeader = false  
)
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.
返回
OK on success.

◆  CompareFiles()

static MAXON_METHOD Result <void> CompareFiles ( UrlOrInputStream &&  file1 ,
UrlOrInputStream &&  file2  
)
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.
返回
Success and result of the comparison. If the files don't match or cannot be read an error is returned.

◆  ReadToArray()

Result < void > ReadToArray ( UrlOrInputStream &&  url ,
BaseArray < T > &  dest  
)
static

Reads stream directly into an array

参数
[in] url path to stream
[out] dest BaseArray where the data is stored

◆  CopyStream()

static MAXON_METHOD Result <void> CopyStream ( const InputStreamRef &  from ,
const OutputStreamRef &  to  
)
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.
返回
Success of operation.

◆  CopyFileOrDirectory() [1/2]

static MAXON_METHOD Result <void> CopyFileOrDirectory ( const Url from ,
const Url to  
)
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.

参数
[in] from The source Url .
[in] to The destination Url .
返回
Success of operation.

◆  CopyFileOrDirectory() [2/2]

static MAXON_METHOD Result <void> CopyFileOrDirectory ( const Url from ,
const String to ,
const WriteArchiveRef &  archive  
)
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.
返回
Success of operation.