use a little bit of java 8. at first I tried to rewrite iterFields as
eachField(o, consumer) but it turns out that's not very practical as the
consumer writes to an output stream and therefore throws checked
exceptions which must be handled within the lambda expression. i.e. they
do not propagate up the call stack to the function within which they are
defined (which declares "throws IOException")