public static byte[] readFileToByteArray(final File file) throws IOException {
        InputStream in = openInputStream(file);
        try {
            final long fileLength = file.length();
            return fileLength > 0 ? IoUtils.toByteArray(in, (int)fileLength) : IoUtils.toByteArray(in);
        } finally {
            in.close();
        }
    }
Reads the contents of a file into a byte array. * The file is always closed.

@param file
@return
@throws IOException
fastexcel-core/src/main/java/cn/idev/excel/util/FileUtils.java