/**
* This class is a specialized input stream that is designed to check and drain the system buffer (by reading
* whatever is available from the socket) pretty much every time there is a read operation.
*
* This is necessary because the DADS server is able to write a large amount of data to the AOI socket, overflowing
* the system buffer if we don't keep it drained. Buffer overflows cause fatal parse errors.
*/
class GreedyBufferedInputStream(private var socket: Socket, logger: Logger = null) extends InputStream with TimeoutAdjustable {