I need to write a function that takes in some kind of input stream thing (e.g. an InputStream or a FileChannel) in order to read a large file in two passes: once to precompu
BufferedInputStream has mark(readlimit) and reset().
readlimit should be larger than filesize to make mark valid.
file.length()+1 is OK.
This means mark is valid until readlimit bytes are read, thus you can go back by reset().