Asynchronously copies all the available data from the input stream into the output stream. The input stream is automatically closed at the end. Returns an object that should be used as the sender filter. Example: WaitFor (File.Copy2Async(in, out)) Complete (SuccessAsBoolean)
Log("Success: " & Success)
Asynchronously copies the source file to the target path. Note that it is not possible to copy files to the Assets folder. Returns an object that should be used as the sender filter. Example: WaitFor (File.CopyAsync(File.DirAssets, "1.txt", File.DirInternal, "1.txt")) Complete (SuccessAsBoolean)
Log("Success: " & Success)
Delete (DirAsString, FileNameAsString) AsBoolean
Deletes the specified file. If the file name is a directory then it must be empty in order to be deleted. Returns true if the file was successfully deleted. Files in the assets folder cannot be deleted.
DirAssetsAsString [read only]
Returns a reference to the files added to the Files tab. These files are read-only.
DirDefaultExternalAsString [read only]
Returns the application default external folder which is based on the package name. The folder is created if needed. You should use RuntimePermissions.GetSafeDirDefaultExternal instead.
DirInternalAsString [read only]
Returns the folder in the device internal storage that is used to save application private data.
DirInternalCacheAsString [read only]
Returns the folder in the device internal storage that is used to save application cache data. This data will be deleted automatically when the device runs low on storage.
DirRootExternalAsString [read only]
Returns the root folder of the external storage media. This folder requires the WRITE_EXTERNAL_STORAGE permission. Only use it if you really need to access this folder. You should probably use File.DirInternal or RuntimePermissions.GetSafeDirDefaultExternal instead.
Exists (DirAsString, FileNameAsString) AsBoolean
Returns true if the specified FileName exists in the specified Dir. Note that the Android file system is case sensitive.
Example: IfFile.Exists(File.DirDefaultExternal, "MyFile.txt") Then ...
ExternalReadableAsBoolean [read only]
Tests whether the external storage media can be read from.
ExternalWritableAsBoolean [read only]
Tests whether the external storage media can be written to (and also read from).
GetText (DirAsString, FileNameAsString) AsString
Reads the entire file and returns its text. The file is assumed to be encoded with UTF8.
Returns the last modified date of the specified file. This method does not support files in the assets folder. Example: DimdAsLong d = File.LastModified(File.DirRootExternal, "1.txt")
Msgbox(DateTime.Date(d), "Last modified")
ListFiles (DirAsString) AsList
Returns a read only list with all the files and directories which are stored in the specified path. An uninitialized list will be returned if the folder is not accessible.
ListFilesAsync (DirAsString) AsObject
Asynchronous version of ListFiles. Should be used with Wait For. Example: WaitFor (File.ListFilesAsync(Dir)) Complete (SuccessAsBoolean, FilesAsList)
MakeDir (ParentAsString, DirAsString)
Creates the given folder (creates all folders as needed). Example: File.MakeDir(File.DirInternal, "music/90")
Opens (or creates) the specified file which is located in the Dir folder for writing. If Append is true then the new data will be written at the end of the existing file.
Reads the entire file and returns a List with all lines (as strings). Example: DimList1AsList List1 = File.ReadList(File.DirDefaultExternal, "1.txt")
Fori = 0toList1.Size - 1 Log(List1.Get(i))
Next
ReadMap (DirAsString, FileNameAsString) AsMap
Reads the file and parses each line as a key-value pair (of strings). See this link for more information about the actual format: Properties format. You can use File.WriteMap to write a map to a file. Note that the order of items in the map may not be the same as the order in the file.
Similar to ReadMap. ReadMap2 adds the items to the given Map. By using ReadMap2 with a populated map you can force the items order as needed. Example: DimmAsMap m.Initialize m.Put("Item #1", "")
m.Put("Item #2", "")
m = File.ReadMap2(File.DirInternal, "settings.txt", m)
Writes each item in the list as a single line. Note that a value containing CRLF will be saved as two lines (which will return two item when read with ReadList). All values will be converted to strings. Example: File.WriteList (File.DirInternal, "mylist.txt", List1)
Creates a new file and writes the given map. Each key value pair is written as a single line. All values are converted to strings. See this link for more information about the actual format: Properties format. You can use File.ReadMap to read this file.
A stream that you can read from. Usually you will pass the stream to a "higher level" object like TextReader that will handle the reading. You can use File.OpenInput to get a file input stream.
Use File.OpenInput to get a file input stream. This method should be used to read data from a bytes array. Initializes the input stream and sets it to read from the specified bytes array. StartOffset - The first byte that will be read. MaxCount - Maximum number of bytes to read.
Reads up to MaxCount bytes from the stream and writes it to the given Buffer. The first byte will be written at StartOffset. Returns the number of bytes actually read. Returns -1 if there are no more bytes to read. Otherwise returns at least one byte. Example: Dimbuffer(1024) Asbyte count = InputStream1.ReadBytes(buffer, 0, buffer.length)
A stream that you can write to. Usually you will pass the stream to a "higher level" object like TextWriter which will handle the writing. Use File.OpenOutput to get a file output stream.
Use File.OpenOutput to get a file output stream. This method should be used to write data to a bytes array. StartSize - The starting size of the internal bytes array. The size will increase if needed.
IsInitializedAsBoolean
ToBytesArrayAsByte()
Returns a copy of the internal bytes array. Can only be used when the output stream was initialized with InitializeToBytesArray.
Reads text from the underlying stream. In most cases you should avoid using TextReader and instead read the text with File.ReadString or File.ReadList.
Reads characters from the stream and into the Buffer. Reads up to Length characters and puts them in the Buffer starting as StartOffset. Returns the actual number of characters read from the stream. Returns -1 if there are no more characters available.
ReadAllAsString
Reads all of the remaining text and closes the stream.
ReadLineAsString
Reads the next line from the stream. The new line characters are not returned. Returns Null if there are no more characters to read.
Example: DimReaderAsTextReader Reader.Initialize(File.OpenInput(File.DirInternal, "1.txt"))
DimlineAsString line = Reader.ReadLine DoWhileline <> Null Log(line)
line = Reader.ReadLine Loop Reader.Close
ReadListAsList
Reads the remaining text and returns a List object filled with the lines. Closes the stream when done.
ReadyAsBoolean
Tests whether there is at least one character ready for reading without blocking.
Skip (NumberOfCharacetersAsInt) AsInt
Skips the specified number of characters. Returns the actual number of characters that were skipped (which may be less than the specified value).
Example: DimWriterAsTextWriter Writer.Initialize(File.OpenOutput(File.DirDefaultExternal, "1.txt", False))
Writer.WriteLine("This is the first line.")
Writer.WriteLine("This is the second line.")
Writer.Close
Initializes this object by wrapping the given OutputStream using the specified encoding.
IsInitializedAsBoolean
Write (TextAsString)
Writes the given Text to the stream.
WriteLine (TextAsString)
Writes the given Text to the stream followed by a new line character. Example: DimWriterAsTextWriter Writer.Initialize(File.OpenOutput(File.DirDefaultExternal, "1.txt", False))
Writer.WriteLine("This is the first line.")
Writer.WriteLine("This is the second line.")
Writer.Close
WriteList (ListAsList)
Writes each item in the list as a single line. Note that a value containing CRLF will be saved as two lines (which will return two item when read with ReadList). All values will be converted to strings.
Top