Press on the image to return to the main documentation page.
Files (Core)
List of types:
File
InputStream
OutputStream
File
A predefined object containing files related methods. Note that iOS devices file system is case sensitive.
Note that each application can only access its own files. There is not any shared location (such as Android File.DirRootExternal).
Events:
None
Members:
Combine
(
Dir
As
String
,
FileName
As
String
)
As
String
Copy
(
DirSource
As
String
,
FileSource
As
String
,
DirTarget
As
String
,
FileTarget
As
String
)
Copy2
(
In
As
InputStream
,
Out
As
OutputStream
)
Delete
(
Dir
As
String
,
FileName
As
String
)
As
Boolean
DirAssets
As
String
[read
only]
DirDocuments
As
String
[read
only]
DirLibrary
As
String
[read
only]
DirTemp
As
String
[read
only]
Exists
(
Dir
As
String
,
FileName
As
String
)
As
Boolean
GetAttributes
(
Dir
As
String
,
FileName
As
String
)
As
Map
IsDirectory
(
Dir
As
String
,
FileName
As
String
)
As
Boolean
LastModified
(
Dir
As
String
,
FileName
As
String
)
As
Long
ListFiles
(
Dir
As
String
)
As
List
MakeDir
(
Parent
As
String
,
Dir
As
String
)
OpenInput
(
Dir
As
String
,
FileName
As
String
)
As
InputStream
OpenOutput
(
Dir
As
String
,
FileName
As
String
,
Append
As
Boolean
)
As
OutputStream
ReadList
(
Dir
As
String
,
FileName
As
String
)
As
List
ReadMap
(
Dir
As
String
,
FileName
As
String
)
As
Map
ReadString
(
Dir
As
String
,
FileName
As
String
)
As
String
ReadString2
(
Dir
As
String
,
FileName
As
String
,
CharSet
As
String
)
As
String
SetExcludeFromBackup
(
Dir
As
String
,
FileName
As
String
,
Value
As
Boolean
)
Size
(
Dir
As
String
,
FileName
As
String
)
As
Long
WriteList
(
Dir
As
String
,
FileName
As
String
,
List
As
List
)
WriteMap
(
Dir
As
String
,
FileName
As
String
,
Map
As
Map
)
WriteString
(
Dir
As
String
,
FileName
As
String
,
Text
As
String
)
WriteString2
(
Dir
As
String
,
FileName
As
String
,
Text
As
String
,
CharSet
As
String
)
Members description:
Combine
(
Dir
As
String
,
FileName
As
String
)
As
String
Combines the Dir and FileName to a single string.
Copy
(
DirSource
As
String
,
FileSource
As
String
,
DirTarget
As
String
,
FileTarget
As
String
)
Copies the source file to the target location.
Copy2
(
In
As
InputStream
,
Out
As
OutputStream
)
Copies the input stream to the output stream. The input stream is closed at the end.
Delete
(
Dir
As
String
,
FileName
As
String
)
As
Boolean
Deletes the given file. Returns true if the file was deleted.
DirAssets
As
String
[read
only]
Returns a reference to the files added to the Files tab. These files are read-only.
DirDocuments
As
String
[read
only]
The documents folder should only be used to store user generated content. It is possible to make this folder sharable through iTunes.
This folder is backed up by iTunes automatically.
DirLibrary
As
String
[read
only]
The place for any non-user generated persistent files. This folder is backed up by iTunes automatically.
You can create a subfolder named Caches. Files under that folder will not be backed up.
DirTemp
As
String
[read
only]
A temporary folder. Files in this folder are not backed up by iTunes and may be deleted from time to time.
Exists
(
Dir
As
String
,
FileName
As
String
)
As
Boolean
Checks whether the given file exists.
GetAttributes
(
Dir
As
String
,
FileName
As
String
)
As
Map
(advanced) Returns a Map with the file attributes.
IsDirectory
(
Dir
As
String
,
FileName
As
String
)
As
Boolean
Tests whether the specified file is a directory.
LastModified
(
Dir
As
String
,
FileName
As
String
)
As
Long
ListFiles
(
Dir
As
String
)
As
List
Returns a List with the files under the specified directory. Does not work with the assets folder.
MakeDir
(
Parent
As
String
,
Dir
As
String
)
Creates a new folder under Parent folder/
OpenInput
(
Dir
As
String
,
FileName
As
String
)
As
InputStream
Opens an InputStream to the given file.
OpenOutput
(
Dir
As
String
,
FileName
As
String
,
Append
As
Boolean
)
As
OutputStream
Opens an OutputStream to the given file.
Append - If true then new data will be appended to the existing data.
ReadList
(
Dir
As
String
,
FileName
As
String
)
As
List
Reads the given text file and returns a list. Each line in the file is converted to a list item.
ReadMap
(
Dir
As
String
,
FileName
As
String
)
As
Map
Reads a Map written with File.WriteMap.
ReadString
(
Dir
As
String
,
FileName
As
String
)
As
String
Reads the text file with UTF8 encoding.
ReadString2
(
Dir
As
String
,
FileName
As
String
,
CharSet
As
String
)
As
String
Reads the text file with the given encoding.
SetExcludeFromBackup
(
Dir
As
String
,
FileName
As
String
,
Value
As
Boolean
)
Marks a file to be excluded from iTunes backup.
Size
(
Dir
As
String
,
FileName
As
String
)
As
Long
Returns the file size.
WriteList
(
Dir
As
String
,
FileName
As
String
,
List
As
List
)
Writes a list of strings or numbers to a text file. Each item is written as a single line.
WriteMap
(
Dir
As
String
,
FileName
As
String
,
Map
As
Map
)
Writes a Map of strings or numbers to a text file.
WriteString
(
Dir
As
String
,
FileName
As
String
,
Text
As
String
)
Writes the string to a file with UTF8 encoding.
WriteString2
(
Dir
As
String
,
FileName
As
String
,
Text
As
String
,
CharSet
As
String
)
Writes the string to a file with the specified encoding.
InputStream
A stream that you can read from. Use File.OpenInput to get a file input stream.
Events:
None
Members:
Close
InitializeFromBytesArray
(
Buffer
()
As
Byte
,
StartOffset
As
Int
,
Length
As
Int
)
IsInitialized
As
Boolean
ReadBytes
(
Buffer
()
As
Byte
,
StartOffset
As
Int
,
MaxCount
As
Int
)
As
Int
Tag
As
Object
Members description:
Close
Closes the input stream.
InitializeFromBytesArray
(
Buffer
()
As
Byte
,
StartOffset
As
Int
,
Length
As
Int
)
Initializes an InputStream that reads from a bytes array.
Buffer - The bytes array.
StartOffset - First byte will be read from this offset.
Length - Number of bytes to expose to the stream.
IsInitialized
As
Boolean
Tests whether this object was initialized.
ReadBytes
(
Buffer
()
As
Byte
,
StartOffset
As
Int
,
MaxCount
As
Int
)
As
Int
Reads bytes to the stream and writes them to the buffer. Returns the number of bytes read.
Buffer - Data will be written to this buffer.
StartOffset - The first byte will be written at this offset.
MaxCount - Maximum number of bytes to read.
Tag
As
Object
Gets or sets the Tag object. This is a placeholder for any object you like to tie to this object.
OutputStream
A stream that is used to write data to.
You can open a file output stream with File.OpenOutput.
Events:
None
Members:
Close
InitializeToBytesArray
(
StartSize
As
Int
)
IsInitialized
As
Boolean
Tag
As
Object
ToBytesArray
As
Byte
()
WriteBytes
(
Buffer
()
As
Byte
,
StartOffset
As
Int
,
Length
As
Int
)
Members description:
Close
Closes the output stream.
InitializeToBytesArray
(
StartSize
As
Int
)
Creates a memory stream. Call ToBytesArray to convert the written data to an array of bytes.
StartSize - Currently not used.
IsInitialized
As
Boolean
Tests whether this object was initialized.
Tag
As
Object
Gets or sets the Tag object. This is a placeholder for any object you like to tie to this object.
ToBytesArray
As
Byte
()
Converts a memory stream to an array of bytes.
WriteBytes
(
Buffer
()
As
Byte
,
StartOffset
As
Int
,
Length
As
Int
)
Writes the given bytes to the stream.
Buffer - Data to write.
StartOffset - Offset of first byte.
Length - Number of bytes to write.
Top