Files.ReadAllBytes(IPath) Method

Definition

Reads all the bytes from a file.

[Android.Runtime.Register("readAllBytes", "(Ljava/nio/file/Path;)[B", "", ApiSince=26)]
public static byte[]? ReadAllBytes (Java.Nio.FileNio.IPath? path);
[<Android.Runtime.Register("readAllBytes", "(Ljava/nio/file/Path;)[B", "", ApiSince=26)>]
static member ReadAllBytes : Java.Nio.FileNio.IPath -> byte[]

Parameters

path
IPath

the path to the file

Returns

Byte[]

a byte array containing the bytes read from the file

Attributes

Remarks

Reads all the bytes from a file. The method ensures that the file is closed when all bytes have been read or an I/O error, or other runtime exception, is thrown.

Note that this method is intended for simple cases where it is convenient to read all bytes into a byte array. It is not intended for reading in large files.

Java documentation for java.nio.file.Files.readAllBytes(java.nio.file.Path).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to