Seems to me like it would be more appropriate to use a FileInputStream to read a desired number of bytes from the file, process those bytes accordingly and continu that process of reading/processing until the end of the file is reached or all relevant bytes have been processed. Anyway, if that is somehow not an option you could use String#getBytes() to fill a ByteArrayInputStream, I guess.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads