Use the FileUtils#readFileToByteArray(File)
from Apache Commons IO, and then create the ByteArrayInputStream
using the ByteArrayInputStream(byte[])
constructor.
public static ByteArrayInputStream retrieveByteArrayInputStream(File file) {
return new ByteArrayInputStream(FileUtils.readFileToByteArray(file));
}