title: java file input with rewind()/reset() capability
body: <p>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 precompute some capacities, and second to do the "real" work. I do not want the whole file loaded into memory at once (unless it is small).</p>
  
  <p><strong>Is there an appropriate Java class that provides this capability?</strong> FileInputStream itself does not support mark()/reset(). BufferedInputStream does, I think, but I'm not clear whether it has to store the whole file to do this.</p>
  
  <p>C is so simple, you just use fseek(), ftell(), and rewind(). :-(</p>