Mercurial Hosting > nabble
view src/nabble/naml/compiler/TemplatePrintWriter.java @ 62:4674ed7d56df default tip
remove n2
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 30 Sep 2023 20:25:29 -0600 |
parents | 7ecd1a4ef557 |
children |
line wrap: on
line source
package nabble.naml.compiler; import java.io.Writer; public class TemplatePrintWriter extends PrintWriter { public static final TemplatePrintWriter NULL = new TemplatePrintWriter( new Writer() { public void write(char[] cbuf,int off,int len) {} public void flush() {} public void close() {} } ); public TemplatePrintWriter(Writer out) { super(out); } public void print(Object obj) { if( obj == null ) throw new NamlNullPointerException("null written to stream"); if( obj instanceof BlockWrapper ) { ((BlockWrapper)obj).printTo(this); } else { super.print(obj); } } public void print(String s) { if( s == null ) throw new NamlNullPointerException("null written to stream"); super.print(s); } public void print(Boolean b) { throw new RuntimeException("no Booleans allowed, use boolean instead"); } }