Can anybody tell me how to get the current position of the index while reading the binary file from DataInputStream
? I have seen a mark()
method but one is Boolean
type and the other is void
. I need to read the indexes on separate locations to use them again.
views:
28answers:
1
+1
A:
Similar questions have been asked before. See for instance this question.
I don't know of any better answer than this:
A simple solution however, would be to roll your own "CountingInputStream" that extends InputStream and counts the number of bytes read. You would basically just need to override the three read-methods.
One could also implement it as a FilterInputStream directly.
aioobe
2010-08-12 06:36:09