e.printStackTrace();
}
else
out = System.out;
MarcStreamWriter writer = null;
if (encoding != null)
writer = new MarcStreamWriter(out, encoding);
else
writer = new MarcStreamWriter(out);
if (convert != null) {
CharConverter charconv = null;
if (Constants.MARC_8_ENCODING.equals(convert))
charconv = new UnicodeToAnsel();
else if (Constants.ISO5426_ENCODING.equals(convert))
charconv = new UnicodeToIso5426();
else if (Constants.ISO6937_ENCODING.equals(convert))
charconv = new UnicodeToIso6937();
else {
System.err.println("Unknown character set");
System.exit(1);
}
writer.setConverter(charconv);
}
while (reader.hasNext()) {
Record record = reader.next();
if (Constants.MARC_8_ENCODING.equals(convert))
record.getLeader().setCharCodingScheme(' ');
writer.write(record);
}
writer.close();
System.err.println("Total time: "
+ (System.currentTimeMillis() - start) + " miliseconds");
}