title: Read lines from Java FileInputStream without losing my place
body: <p>I have a FileInputStream.  I'd like to read character-oriented, linewise data from it, until I find a particular delimiter.  Then I'd like to pass the FileInputStream, <em>with the current position set immediately after the end of the delimiter line</em>, to a library that needs an InputStream.</p>
  
  <p>I can use a BufferedReader to walk through the file a line at a time, and everything works great.  However, this leaves the underlying file stream in</p>
  
  <pre><code>BufferedReader br = new BufferedReader(new InputStreamReader(myFileStream))
  </code></pre>
  
  <p>at a non-deterministic position -- the BufferedReader had to look ahead, and I don't know how far, and AFAICT there's no way to tell the BufferedReader to rewind the underlying stream to just after the last-returned line.</p>
  
  <p>Is <a href="https://stackoverflow.com/questions/18749947/convert-bufferedreader-to-inputstream">this</a> the best solution?  It seems crazy to have a <code>ReaderInputStream(BufferedReader(InputStreamReader(FileInputStream)))</code> but it's the only way I've seen to avoid rolling my own.  I'd really like to avoid writing my own entire stream-that-reads-lines implementation if at all possible.</p>