writeList(ser, fos, listElement, list);
}
private <T> void writeList(Serializer ser, OutputStream os, String listElement, List<T> list) throws Exception {
Format format = new Format("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
OutputNode doc = NodeBuilder.write(new OutputStreamWriter(os, "UTF-8"), format);
OutputNode root = doc.getChild("root");
root.setComment(BACKUP_COMMENT);
OutputNode listNode = root.getChild(listElement);
if (list != null) {
for (T t : list) {
try {
ser.write(t, listNode);