let's avoid doing this in next() -- the cost of reflection is too high to do this on every call. You can make the instanceof check when the reader is first set, and just use a boolean here and in other places below.