Add CsvOutputFormat for new Java API

Also add some small fixes for TypeExtractor.