File
Overview
Represents a file. Provides information about the file and its content, and ways to manipulate them.
Use case
You can use File to work with individual file:
var Files: array of File := Folder.UserLocal.GetFiles;
writeLn("Folder: "+Folder.UserLocal.Path);
writeLn("Files:");
for item in Files do
writeLn(item.Name);
Location
- Reference: Sugar
- Namespace: Sugar.IO
constructor
constructor(aPath: not nullable String)
File(String! aPath)
init(_ aPath: String)
File(String aPath)
Sub New(aPath As String)
Parameters:
- aPath:
class method Copy(FileName: not nullable File; NewPathAndName: not nullable File): not nullable File
static File! Copy(File! FileName, File! NewPathAndName)
static func Copy(_ FileName: File, _ NewPathAndName: File) -> File
static File Copy(File FileName, File NewPathAndName)
Shared Function Copy(FileName As File, NewPathAndName As File) As File
Parameters:
- FileName:
- NewPathAndName:
method Copy(NewPathAndName: not nullable File): not nullable File
File! Copy(File! NewPathAndName)
func Copy(_ NewPathAndName: File) -> File
File Copy(File NewPathAndName)
Function Copy(NewPathAndName As File) As File
Parameters:
- NewPathAndName:
method Copy(Destination: not nullable Folder; NewName: not nullable String): not nullable File
File! Copy(Folder! Destination, String! NewName)
func Copy(_ Destination: Folder, _ NewName: String) -> File
File Copy(Folder Destination, String NewName)
Function Copy(Destination As Folder, NewName As String) As File
Parameters:
- Destination:
- NewName:
DateCreated
property DateCreated: DateTime read;
DateTime DateCreated { get; }
var DateCreated: DateTime { get{} }
DateTime DateCreated { __get; }
ReadOnly Property DateCreated() As DateTime
DateModified
property DateModified: DateTime read;
DateTime DateModified { get; }
var DateModified: DateTime { get{} }
DateTime DateModified { __get; }
ReadOnly Property DateModified() As DateTime
Delete mapped
method Delete
void Delete()
func Delete()
void Delete()
Sub Delete()
Extension
property Extension: String read;
String Extension { get; }
var Extension: String { get{} }
String Extension { __get; }
ReadOnly Property Extension() As String
FullPath
property FullPath: String read;
String FullPath { get; }
var FullPath: String { get{} }
String FullPath { __get; }
ReadOnly Property FullPath() As String
class method Move(FileName: not nullable File; NewPathAndName: not nullable File): not nullable File
static File! Move(File! FileName, File! NewPathAndName)
static func Move(_ FileName: File, _ NewPathAndName: File) -> File
static File Move(File FileName, File NewPathAndName)
Shared Function Move(FileName As File, NewPathAndName As File) As File
Parameters:
- FileName:
- NewPathAndName:
method Move(NewPathAndName: not nullable File): not nullable File
File! Move(File! NewPathAndName)
func Move(_ NewPathAndName: File) -> File
File Move(File NewPathAndName)
Function Move(NewPathAndName As File) As File
Parameters:
- NewPathAndName:
method Move(DestinationFolder: not nullable Folder; NewName: not nullable String): not nullable File
File! Move(Folder! DestinationFolder, String! NewName)
func Move(_ DestinationFolder: Folder, _ NewName: String) -> File
File Move(Folder DestinationFolder, String NewName)
Function Move(DestinationFolder As Folder, NewName As String) As File
Parameters:
- DestinationFolder:
- NewName:
Name
property Name: String read;
String Name { get; }
var Name: String { get{} }
String Name { __get; }
ReadOnly Property Name() As String
Open mapped
method Open(Mode: FileOpenMode): not nullable FileHandle
FileHandle! Open(FileOpenMode Mode)
func Open(_ Mode: FileOpenMode) -> FileHandle
FileHandle Open(FileOpenMode Mode)
Function Open(Mode As FileOpenMode) As FileHandle
Parameters:
- Mode:
ReadBinary mapped
method ReadBinary: Binary
Binary ReadBinary()
func ReadBinary() -> Binary
Binary ReadBinary()
Function ReadBinary() As Binary
ReadBytes mapped
method ReadBytes: array of Byte
Byte[] ReadBytes()
func ReadBytes() -> Byte...
Byte[] ReadBytes()
Function ReadBytes() As Byte()
ReadText mapped
method ReadText(Encoding: Encoding): String
String ReadText(Encoding Encoding)
func ReadText(_ Encoding: Encoding) -> String
String ReadText(Encoding Encoding)
Function ReadText(Encoding As Encoding) As String
Parameters:
- Encoding:
class method Rename(FileName: not nullable File; NewName: not nullable String): not nullable File
static File! Rename(File! FileName, String! NewName)
static func Rename(_ FileName: File, _ NewName: String) -> File
static File Rename(File FileName, String NewName)
Shared Function Rename(FileName As File, NewName As String) As File
Parameters:
- FileName:
- NewName:
method Rename(NewName: not nullable String): not nullable File
File! Rename(String! NewName)
func Rename(_ NewName: String) -> File
File Rename(String NewName)
Function Rename(NewName As String) As File
Parameters:
- NewName:
DateCreated
property DateCreated: DateTime read;
DateTime DateCreated { get; }
var DateCreated: DateTime { get{} }
DateTime DateCreated { __get; }
ReadOnly Property DateCreated() As DateTime
DateModified
property DateModified: DateTime read;
DateTime DateModified { get; }
var DateModified: DateTime { get{} }
DateTime DateModified { __get; }
ReadOnly Property DateModified() As DateTime
Extension
property Extension: String read;
String Extension { get; }
var Extension: String { get{} }
String Extension { __get; }
ReadOnly Property Extension() As String
FullPath
property FullPath: String read;
String FullPath { get; }
var FullPath: String { get{} }
String FullPath { __get; }
ReadOnly Property FullPath() As String
Name
property Name: String read;
String Name { get; }
var Name: String { get{} }
String Name { __get; }
ReadOnly Property Name() As String
class method Copy(FileName: not nullable File; NewPathAndName: not nullable File): not nullable File
static File! Copy(File! FileName, File! NewPathAndName)
static func Copy(_ FileName: File, _ NewPathAndName: File) -> File
static File Copy(File FileName, File NewPathAndName)
Shared Function Copy(FileName As File, NewPathAndName As File) As File
Parameters:
- FileName:
- NewPathAndName:
class method Move(FileName: not nullable File; NewPathAndName: not nullable File): not nullable File
static File! Move(File! FileName, File! NewPathAndName)
static func Move(_ FileName: File, _ NewPathAndName: File) -> File
static File Move(File FileName, File NewPathAndName)
Shared Function Move(FileName As File, NewPathAndName As File) As File
Parameters:
- FileName:
- NewPathAndName:
class method Rename(FileName: not nullable File; NewName: not nullable String): not nullable File
static File! Rename(File! FileName, String! NewName)
static func Rename(_ FileName: File, _ NewName: String) -> File
static File Rename(File FileName, String NewName)
Shared Function Rename(FileName As File, NewName As String) As File
Parameters:
- FileName:
- NewName:
constructor
constructor(aPath: not nullable String)
File(String! aPath)
init(_ aPath: String)
File(String aPath)
Sub New(aPath As String)
Parameters:
- aPath:
method Copy(NewPathAndName: not nullable File): not nullable File
File! Copy(File! NewPathAndName)
func Copy(_ NewPathAndName: File) -> File
File Copy(File NewPathAndName)
Function Copy(NewPathAndName As File) As File
Parameters:
- NewPathAndName:
method Copy(Destination: not nullable Folder; NewName: not nullable String): not nullable File
File! Copy(Folder! Destination, String! NewName)
func Copy(_ Destination: Folder, _ NewName: String) -> File
File Copy(Folder Destination, String NewName)
Function Copy(Destination As Folder, NewName As String) As File
Parameters:
- Destination:
- NewName:
Delete mapped
method Delete
void Delete()
func Delete()
void Delete()
Sub Delete()
method Move(NewPathAndName: not nullable File): not nullable File
File! Move(File! NewPathAndName)
func Move(_ NewPathAndName: File) -> File
File Move(File NewPathAndName)
Function Move(NewPathAndName As File) As File
Parameters:
- NewPathAndName:
method Move(DestinationFolder: not nullable Folder; NewName: not nullable String): not nullable File
File! Move(Folder! DestinationFolder, String! NewName)
func Move(_ DestinationFolder: Folder, _ NewName: String) -> File
File Move(Folder DestinationFolder, String NewName)
Function Move(DestinationFolder As Folder, NewName As String) As File
Parameters:
- DestinationFolder:
- NewName:
Open mapped
method Open(Mode: FileOpenMode): not nullable FileHandle
FileHandle! Open(FileOpenMode Mode)
func Open(_ Mode: FileOpenMode) -> FileHandle
FileHandle Open(FileOpenMode Mode)
Function Open(Mode As FileOpenMode) As FileHandle
Parameters:
- Mode:
ReadBinary mapped
method ReadBinary: Binary
Binary ReadBinary()
func ReadBinary() -> Binary
Binary ReadBinary()
Function ReadBinary() As Binary
ReadBytes mapped
method ReadBytes: array of Byte
Byte[] ReadBytes()
func ReadBytes() -> Byte...
Byte[] ReadBytes()
Function ReadBytes() As Byte()
ReadText mapped
method ReadText(Encoding: Encoding): String
String ReadText(Encoding Encoding)
func ReadText(_ Encoding: Encoding) -> String
String ReadText(Encoding Encoding)
Function ReadText(Encoding As Encoding) As String
Parameters:
- Encoding:
method Rename(NewName: not nullable String): not nullable File
File! Rename(String! NewName)
func Rename(_ NewName: String) -> File
File Rename(String NewName)
Function Rename(NewName As String) As File
Parameters:
- NewName: