FoundationDB/sql-layer-client-tools — pull request #111 by MMcM (2014-12-17 23:57:47+00:00)
Title: Try to use existing bytes buffer before doing file I/O.

In order to have an accurate `position` when `readLine` returns, characters must be decoded one a a time. This led to refilling the byte buffer one byte at a time to try to keep it maximally full.

Instead, first try to use any existing bytes. If that doesn't get any chars, then refill from the file and try again.

NIO is a bit tricky, so I'm open to any suggestions on how to make this method clearer.