MarcStreamReader reader = new MarcStreamReader(input);
ByteArrayOutputStream out = new ByteArrayOutputStream();
MarcStreamWriter writer = new MarcStreamWriter(out, "UTF8");
writer.setConverter(new AnselToUnicode());
while (reader.hasNext()) {
Record record = reader.next();
writer.write(record);
counter++;
}
input.close();
writer.close();
assertEquals(8, counter);
counter = 0;
input = new ByteArrayInputStream(out.toByteArray());
reader = new MarcStreamReader(input, "UTF8");
while (reader.hasNext()) {
Record record = reader.next();
counter++;
}
input.close();
assertEquals(8, counter);