Take a look at the constructor for ByteArrayInputStream in the JavaDoc. It wants a byte array argument.
So, you'll need a way to read a file into a byte array. One challenge with arrays is you have to declare the size up front. Fortunately you can get the size of a file from the File object.
Now you're looking at something like:
Lemme know if that helps.
Now, to take a right-angle turn ... why do you have to create a ByteArrayInputStream? If an instructor has told you to, well, I guess you're stuck. But if the other class that wants this thing can be changed, it really ought to just demand an InputStream. Then any InputStream would do the job ... FileInputStream, ByteArrayInputStream, and so on. The other class would be able to use many different data sources instead of just one kind. Did that makes sense?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi