Table of Contents

Class FileIO

Namespace
Windows.Storage
Assembly
Windows.Storage.dll

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 IStorageFile

The 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 IStorageFile

The 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 IStorageFile

The file that the buffer of data is written to.

buffer IBuffer

The 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 IStorageFile

The 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 IStorageFile

The file that the text is written to.

contents string

The 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).