Class FileIO
Provides helper methods for reading and writing files that are represented by objects of type IStorageFile.
public static class FileIO
- Inheritance
-
FileIO
- Inherited Members
Methods
ReadBuffer(IStorageFile)
Reads the contents of the specified file and returns a buffer.
public static IBuffer ReadBuffer(IStorageFile file)
Parameters
file
IStorageFileThe file to read.
Returns
- IBuffer
When this method completes, it returns an object (type IBuffer) that represents the contents of the file.
Remarks
This method is exclusive of nanoFramework and it's not available in the UWP API. The equivalent method would be ReadBufferAsync(IStorageFile).
ReadText(IStorageFile)
Reads the contents of the specified file and returns text.
public static string ReadText(IStorageFile file)
Parameters
file
IStorageFileThe file to read.
Returns
- string
When this method completes successfully, it returns the contents of the file as a text string.
Remarks
The encoding will always be Utf8 which is the only supported encoding in nanoFramework.
This method is exclusive of nanoFramework and it's not available in the UWP API. The equivalent method would be ReadTextAsync(IStorageFile).
WriteBuffer(IStorageFile, IBuffer)
Writes data from a buffer to the specified file.
public static void WriteBuffer(IStorageFile file, IBuffer buffer)
Parameters
file
IStorageFileThe file that the buffer of data is written to.
buffer
IBufferThe buffer that contains the data to write.
Remarks
This method is exclusive of nanoFramework and it's not available in the UWP API. The equivalent method would be WriteBuffer(IStorageFile, IBuffer).
WriteBytes(IStorageFile, byte[])
Writes an array of bytes of data to the specified file.
public static void WriteBytes(IStorageFile file, byte[] buffer)
Parameters
file
IStorageFileThe file that the byte is written to.
buffer
byte[]The array of bytes to write.
Remarks
This method is exclusive of nanoFramework and it's not available in the UWP API. The equivalent method would be WriteBytesAsync(IStorageFile, Byte[]).
WriteText(IStorageFile, string)
Writes text to the specified file.
public static void WriteText(IStorageFile file, string contents)
Parameters
file
IStorageFileThe file that the text is written to.
contents
stringThe text to write.
Remarks
The encoding will always be Utf8 which is the only supported encoding in nanoFramework.
This method is exclusive of nanoFramework and it's not available in the UWP API. The equivalent method would be WriteTextAsync(IStorageFile, String).