System.IOUtils.TFile
Delphi
TFile = record
C++
struct DECLSPEC_DRECORD TFile
{
private:
static const System::Int8 FCMinFileNameLen = System::Int8(0xc);
static void __fastcall InternalCheckFilePathParam(const System::UnicodeString Path, const bool FileExistsCheck);
static void __fastcall CheckAppendAllTextParameters(const System::UnicodeString Path, System::Sysutils::TEncoding* const Encoding, const bool NeedEncoding);
static void __fastcall CheckAppendTextParameters(const System::UnicodeString Path);
static void __fastcall CheckCopyParameters(const System::UnicodeString SourceFileName, const System::UnicodeString DestFileName, const bool Overwrite);
static void __fastcall CheckCreateParameters(const System::UnicodeString Path);
static void __fastcall CheckCreateTextParameters(const System::UnicodeString Path);
static void __fastcall CheckDecryptParameters(const System::UnicodeString Path);
static void __fastcall CheckDeleteParameters(const System::UnicodeString Path);
static void __fastcall CheckEncryptParameters(const System::UnicodeString Path);
static void __fastcall CheckGetAttributesParameters(const System::UnicodeString Path);
static void __fastcall CheckGetCreationTimeParameters(const System::UnicodeString Path);
static void __fastcall CheckGetCreationTimeUtcParameters(const System::UnicodeString Path);
static void __fastcall CheckGetLastAccessTimeParameters(const System::UnicodeString Path);
static void __fastcall CheckGetLastAccessTimeUtcParameters(const System::UnicodeString Path);
static void __fastcall CheckGetLastWriteTimeParameters(const System::UnicodeString Path);
static void __fastcall CheckGetLastWriteTimeUtcParameters(const System::UnicodeString Path);
static void __fastcall CheckMoveParameters(const System::UnicodeString SourceFileName, const System::UnicodeString DestFileName);
static void __fastcall CheckOpenParameters(const System::UnicodeString Path);
static void __fastcall CheckOpenReadParameters(const System::UnicodeString Path);
static void __fastcall CheckOpenTextParameters(const System::UnicodeString Path);
static void __fastcall CheckOpenWriteParameters(const System::UnicodeString Path);
static void __fastcall CheckReadAllBytesParameters(const System::UnicodeString Path);
static void __fastcall CheckReadAllLinesParameters(const System::UnicodeString Path, System::Sysutils::TEncoding* const Encoding, const bool NeedEncoding);
static void __fastcall CheckReadAllTextParameters(const System::UnicodeString Path, System::Sysutils::TEncoding* const Encoding, const bool NeedEncoding);
static void __fastcall CheckReplaceParameters(const System::UnicodeString SourceFileName, const System::UnicodeString DestinationFileName, const System::UnicodeString DestinationBackupFileName);
static void __fastcall CheckSetAttributesParameters(const System::UnicodeString Path);
static void __fastcall CheckSetCreationTimeParameters(const System::UnicodeString Path);
static void __fastcall CheckSetCreationTimeUtcParameters(const System::UnicodeString Path);
static void __fastcall CheckSetLastAccessTimeParameters(const System::UnicodeString Path);
static void __fastcall CheckSetLastAccessTimeUtcParameters(const System::UnicodeString Path);
static void __fastcall CheckSetLastWriteTimeParameters(const System::UnicodeString Path);
static void __fastcall CheckSetLastWriteTimeUtcParameters(const System::UnicodeString Path);
static void __fastcall CheckWriteAllBytesParameters(const System::UnicodeString Path);
static void __fastcall CheckWriteAllLinesParameters(const System::UnicodeString Path, System::Sysutils::TEncoding* const Encoding, const bool NeedEncoding);
static void __fastcall CheckWriteAllTextParameters(const System::UnicodeString Path, System::Sysutils::TEncoding* const Encoding, const bool NeedEncoding);
static System::Sysutils::TEncoding* __fastcall GetEncoding(System::Classes::TStream* const Stream);
#ifndef _WIN64
static System::DynamicArray<System::UnicodeString> __fastcall GetStringArrayFromText(const System::UnicodeString Text);
static System::Classes::TStringList* __fastcall GetStringListFromArray(const System::DynamicArray<System::UnicodeString> AnArray);
#else /* _WIN64 */
static System::TArray__1<System::UnicodeString> __fastcall GetStringArrayFromText(const System::UnicodeString Text);
static System::Classes::TStringList* __fastcall GetStringListFromArray(const System::TArray__1<System::UnicodeString> AnArray);
#endif /* _WIN64 */
static System::Classes::TFileStream* __fastcall DoCreateOpenFile(const System::UnicodeString Path);
static bool __fastcall DoCopy(const System::UnicodeString SourceFileName, const System::UnicodeString DestFileName, const bool Overwrite);
static TFileAttributes __fastcall DoGetAttributes(const System::UnicodeString Path, bool FollowLink = true);
#ifndef _WIN64
static System::DynamicArray<System::Byte> __fastcall DoReadAllBytes(const System::UnicodeString Path);
#else /* _WIN64 */
static System::TArray__1<System::Byte> __fastcall DoReadAllBytes(const System::UnicodeString Path);
#endif /* _WIN64 */
static System::UnicodeString __fastcall DoReadAllText(const System::UnicodeString Path)/* overload */;
static System::UnicodeString __fastcall DoReadAllText(const System::UnicodeString Path, System::Sysutils::TEncoding* const Encoding)/* overload */;
static void __fastcall DoSetAttributes(const System::UnicodeString Path, const TFileAttributes Attributes);
static void __fastcall DoWriteAllText(const System::UnicodeString Path, const System::UnicodeString Contents, System::Sysutils::TEncoding* const Encoding, const bool WriteBOM);
#ifndef _WIN64
static void __fastcall DoWriteAllLines(const System::UnicodeString Path, const System::DynamicArray<System::UnicodeString> Contents, System::Sysutils::TEncoding* const Encoding, const bool WriteBOM);
#else /* _WIN64 */
static void __fastcall DoWriteAllLines(const System::UnicodeString Path, const System::TArray__1<System::UnicodeString> Contents, System::Sysutils::TEncoding* const Encoding, const bool WriteBOM);
#endif /* _WIN64 */
public:
static TFileAttributes __fastcall IntegerToFileAttributes(const int Attributes);
static int __fastcall FileAttributesToInteger(const TFileAttributes Attributes);
static System::Classes::TFileStream* __fastcall Create(const System::UnicodeString Path)/* overload */;
static System::Classes::TFileStream* __fastcall Create(const System::UnicodeString Path, const int BufferSize)/* overload */;
static void __fastcall AppendAllText(const System::UnicodeString Path, const System::UnicodeString Contents)/* overload */;
static void __fastcall AppendAllText(const System::UnicodeString Path, const System::UnicodeString Contents, System::Sysutils::TEncoding* const Encoding)/* overload */;
static System::Classes::TStreamWriter* __fastcall AppendText(const System::UnicodeString Path);
static void __fastcall Copy(const System::UnicodeString SourceFileName, const System::UnicodeString DestFileName)/* overload */;
static void __fastcall Copy(const System::UnicodeString SourceFileName, const System::UnicodeString DestFileName, const bool Overwrite)/* overload */;
static bool __fastcall CreateSymLink(const System::UnicodeString Link, const System::UnicodeString Target);
static System::Classes::TStreamWriter* __fastcall CreateText(const System::UnicodeString Path);
static void __fastcall Decrypt(const System::UnicodeString Path);
static void __fastcall Delete(const System::UnicodeString Path);
static void __fastcall Encrypt(const System::UnicodeString Path);
static bool __fastcall Exists(const System::UnicodeString Path, bool FollowLink = true);
static __int64 __fastcall GetSize(const System::UnicodeString Path);
static TFileAttributes __fastcall GetAttributes(const System::UnicodeString Path, bool FollowLink = true);
static System::TDateTime __fastcall GetCreationTime(const System::UnicodeString Path);
static System::TDateTime __fastcall GetCreationTimeUtc(const System::UnicodeString Path);
static System::TDateTime __fastcall GetLastAccessTime(const System::UnicodeString Path);
static System::TDateTime __fastcall GetLastAccessTimeUtc(const System::UnicodeString Path);
static System::TDateTime __fastcall GetLastWriteTime(const System::UnicodeString Path);
static System::TDateTime __fastcall GetLastWriteTimeUtc(const System::UnicodeString Path);
static bool __fastcall GetSymLinkTarget(const System::UnicodeString FileName, System::Sysutils::TSymLinkRec &SymLinkRec)/* overload */;
static bool __fastcall GetSymLinkTarget(const System::UnicodeString FileName, System::UnicodeString &TargetName)/* overload */;
static void __fastcall Move(System::UnicodeString SourceFileName, System::UnicodeString DestFileName);
static System::Classes::TFileStream* __fastcall Open(const System::UnicodeString Path, const TFileMode Mode)/* overload */;
static System::Classes::TFileStream* __fastcall Open(const System::UnicodeString Path, const TFileMode Mode, const TFileAccess Access)/* overload */;
static System::Classes::TFileStream* __fastcall Open(const System::UnicodeString Path, const TFileMode Mode, const TFileAccess Access, const TFileShare Share)/* overload */;
static System::Classes::TFileStream* __fastcall OpenRead(const System::UnicodeString Path);
static System::Classes::TStreamReader* __fastcall OpenText(const System::UnicodeString Path);
static System::Classes::TFileStream* __fastcall OpenWrite(const System::UnicodeString Path);
#ifndef _WIN64
static System::DynamicArray<System::Byte> __fastcall ReadAllBytes(const System::UnicodeString Path);
static System::DynamicArray<System::UnicodeString> __fastcall ReadAllLines(const System::UnicodeString Path)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall ReadAllLines(const System::UnicodeString Path, System::Sysutils::TEncoding* const Encoding)/* overload */;
#else /* _WIN64 */
static System::TArray__1<System::Byte> __fastcall ReadAllBytes(const System::UnicodeString Path);
static System::TArray__1<System::UnicodeString> __fastcall ReadAllLines(const System::UnicodeString Path)/* overload */;
static System::TArray__1<System::UnicodeString> __fastcall ReadAllLines(const System::UnicodeString Path, System::Sysutils::TEncoding* const Encoding)/* overload */;
#endif /* _WIN64 */
static System::UnicodeString __fastcall ReadAllText(const System::UnicodeString Path)/* overload */;
static System::UnicodeString __fastcall ReadAllText(const System::UnicodeString Path, System::Sysutils::TEncoding* const Encoding)/* overload */;
static void __fastcall Replace(const System::UnicodeString SourceFileName, const System::UnicodeString DestinationFileName, const System::UnicodeString DestinationBackupFileName)/* overload */;
static void __fastcall Replace(System::UnicodeString SourceFileName, System::UnicodeString DestinationFileName, System::UnicodeString DestinationBackupFileName, const bool IgnoreMetadataErrors)/* overload */;
static void __fastcall SetAttributes(const System::UnicodeString Path, const TFileAttributes Attributes);
static void __fastcall SetCreationTime(const System::UnicodeString Path, const System::TDateTime CreationTime);
static void __fastcall SetCreationTimeUtc(const System::UnicodeString Path, const System::TDateTime CreationTime);
static void __fastcall SetLastAccessTime(const System::UnicodeString Path, const System::TDateTime LastAccessTime);
static void __fastcall SetLastAccessTimeUtc(const System::UnicodeString Path, const System::TDateTime LastAccessTime);
static void __fastcall SetLastWriteTime(const System::UnicodeString Path, const System::TDateTime LastWriteTime);
static void __fastcall SetLastWriteTimeUtc(const System::UnicodeString Path, const System::TDateTime LastWriteTime);
#ifndef _WIN64
static void __fastcall WriteAllBytes(const System::UnicodeString Path, const System::DynamicArray<System::Byte> Bytes);
static void __fastcall WriteAllLines(const System::UnicodeString Path, const System::DynamicArray<System::UnicodeString> Contents)/* overload */;
static void __fastcall WriteAllLines(const System::UnicodeString Path, const System::DynamicArray<System::UnicodeString> Contents, System::Sysutils::TEncoding* const Encoding)/* overload */;
#else /* _WIN64 */
static void __fastcall WriteAllBytes(const System::UnicodeString Path, const System::TArray__1<System::Byte> Bytes);
static void __fastcall WriteAllLines(const System::UnicodeString Path, const System::TArray__1<System::UnicodeString> Contents)/* overload */;
static void __fastcall WriteAllLines(const System::UnicodeString Path, const System::TArray__1<System::UnicodeString> Contents, System::Sysutils::TEncoding* const Encoding)/* overload */;
#endif /* _WIN64 */
static void __fastcall WriteAllText(const System::UnicodeString Path, const System::UnicodeString Contents)/* overload */;
static void __fastcall WriteAllText(const System::UnicodeString Path, const System::UnicodeString Contents, System::Sysutils::TEncoding* const Encoding)/* overload */;
};
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
record struct |
public | System.IOUtils.pas System.IOUtils.hpp |
System.IOUtils | System.IOUtils |
説明
ファイル操作に使用する静的なユーティリティ メソッドを多数含んでいます。
TFile は、ファイルに対してさまざまな操作を行うための静的メソッドだけを含むレコードです。TFile にはインスタンス メソッドやインスタンス フィールドがないため、TFile 型の変数を宣言しないでください。TFile を使って実行できる操作には、次のようなものがあります。
- ファイルの作成、名前変更、削除。
- ファイル内容に対する簡略化されたアクセス。
- ファイルの属性やタイムスタンプの操作。
メモ: TFile が公開しているメソッドのほとんどは、.NET Framework の File クラスが公開しているメソッドと互換性のあるシグニチャになっています。