I have a file that contains some amount of plain text at the start followed by binary content at the end. The size of the binary content is determined by some one of the pla
If you genuinely have a file (rather than something harder to seek in, e.g. a network stream) then I suggest something like this:
You could just call mark()
at the start of the FileInputStream and then reset()
and skip()
to get to the right place if you want to avoid reopening the file. (I was looking for an InputStream.seek()
but I can't see one - I can't remember wanting it before in Java, but does it really not have one? Ick.)