implements a csviterator
split buffer management and state management in their own classes