package xl.model; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Map.Entry; import java.util.Set; /** * Specialized PrintStream for writing XL files. */ public class XLPrintStream extends PrintStream { public XLPrintStream(String fileName) throws FileNotFoundException { super(fileName); } public void save(Set> set) { for (Entry entry : set) { print(entry.getKey()); print('='); Cell cell = entry.getValue(); if (cell instanceof CommentCell) { println("#" + cell.displayValue()); } else { println(cell.displayValue()); } } flush(); close(); } }