To convert a java.io.File to byte[], see the function below
public static byte[] toByteArray(InputStream input, int size)
If the size is not known you can skip mentioning that parameter.This method will return the required byte array.
This method throws an I0Exception if the InputStream mentioned doesn’t match the size given or illegalArgumentException if size is less than zero.