public class

Files

extends Object
java.lang.Object
   ↳ com.facebook.common.internal.Files

Class Overview

Provides utility methods for working with files.

All method parameters must be non-null unless documented otherwise.

Summary

Public Methods
static byte[] toByteArray(File file)
Reads all bytes from a file into a byte array.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static byte[] toByteArray (File file)

Reads all bytes from a file into a byte array.

Parameters
file the file to read from
Returns
  • a byte array containing all the bytes from file
Throws
IllegalArgumentException if the file is bigger than the largest possible byte array (2^31 - 1)
IOException if an I/O error occurs