{
// how many? about 10-20 bytes per entry, so try to get at ~100k -> about 10k entries
List<Entry> entries = generateEntries(9999);
CsvMapper mapper = mapperForCsv();
CsvSchema schema = mapper.schemaFor(Entry.class);
ObjectWriter writer = mapper.writer(schema);
mapper.disable(CsvParser.Feature.WRAP_AS_ARRAY);
// First, using bytes; note
byte[] bytes = writer.writeValueAsBytes(entries);
// ... we just happen to know this is expected length...
final int EXPECTED_BYTES = 97640;
assertEquals(EXPECTED_BYTES, bytes.length);
MappingIterator<Entry> it = mapper.reader(Entry.class).with(schema).readValues(bytes, 0, bytes.length);
verifySame(it, entries);
bytes = null;
// and then chars: NOTE: ASCII, so bytes == chars
String text = writer.writeValueAsString(entries);
assertEquals(EXPECTED_BYTES, text.length());
it.close();
it = mapper.reader(Entry.class).with(schema).readValues(text);
verifySame(it, entries);