@Override public TextInJavaScriptEncoder append(char c, Appendable out) throws IOException { encodeTextInJavaScript(c, out); return this; }
/** * Returns the provided number or zero if the value is empty. * * @see #isEmpty(java.lang.Object) */ public static int zeroIfEmpty(Integer value) throws IOException { return isEmpty(value) ? 0 : value; }
@Override public JavaScriptInXhtmlAttributeEncoder append(CharSequence csq, Appendable out) throws IOException { encodeJavaScriptInXhtmlAttribute(csq==null ? "null" : csq, out); return this; }
@Override public TextInXhtmlEncoder append(char c, Appendable out) throws IOException { encodeTextInXhtml(c, out); return this; }
@Override public TextInXhtmlAttributeEncoder append(char c, Appendable out) throws IOException { encodeTextInXhtmlAttribute(c, out); return this; }
public ChainWriter(PrintWriter out) { this.out=out; javaScriptInXhtmlAttributeWriter = new MediaWriter(javaScriptInXhtmlAttributeEncoder, out); javaScriptInXhtmlWriter = new MediaWriter(javaScriptInXhtmlEncoder, out); }
/** * @see TextInXhtmlAttributeEncoder * * @param value the value to be encoded */ public ChainWriter encodeXmlAttribute(Object value) throws IOException { Coercion.write(value, textInXhtmlAttributeEncoder, out); return this; }
@Override public JavaScriptInXhtmlEncoder append(CharSequence csq, Appendable out) throws IOException { encodeJavaScriptInXhtml(csq==null ? "null" : csq, out); return this; }
/** * Writes a JavaScript script tag that shows a date and time in the user's locale. Prints <code>&#160;</code> * if the date is <code>null</code>. * Writes to the internal <code>PrintWriter</code>. * @see #writeDateTimeJavaScript(long, Appendable) */ public ChainWriter writeDateTimeJavaScript(Date date, Sequence sequence, Appendable scriptOut) throws IOException { writeDateTimeJavaScript(date, sequence, out, scriptOut); return this; }
/** * Writes a JavaScript script tag that shows a date in the user's locale. Prints <code>&#160;</code> * if the date is <code>null</code>. * Writes to the internal <code>PrintWriter</code>. * * @see #writeDateJavaScript(long,Appendable) */ public ChainWriter writeDateJavaScript(Date date, Sequence sequence, Appendable scriptOut) throws IOException { writeDateJavaScript(date, sequence, out, scriptOut); return this; }
/** * Prints a color in HTML format #xxxxxx, where xxxxxx is the hex code. */ public ChainWriter writeHtmlColor(int color) throws IOException { writeHtmlColor(color, out); return this; }
/** * Prints a JavaScript script that will preload the image at the provided URL. */ public ChainWriter writeHtmlImagePreloadJavaScript(String url) throws IOException { writeHtmlImagePreloadJavaScript(url, out); return this; }
/** * Writes a JavaScript script tag that a time in the user's locale. Prints <code>&#160;</code> * if the date is <code>null</code>. * Writes to the internal <code>PrintWriter</code>. * * @see #writeTimeJavaScript(long,Appendable) */ public ChainWriter writeTimeJavaScript(Date date, Sequence sequence, Appendable scriptOut) throws IOException { writeTimeJavaScript(date, sequence, out, scriptOut); return this; } // </editor-fold>
/** * Checks a set of characters, throws IOException if invalid */ public static void checkCharacters(char[] cbuf, int off, int len) throws IOException { int end = off + len; while(off<end) checkCharacter(cbuf[off++]); }
@Override public TextInXhtmlAttributeEncoder append(CharSequence csq, int start, int end, Appendable out) throws IOException { encodeTextInXhtmlAttribute(csq==null ? "null" : csq, start, end, out); return this; } }
/** * Returns the provided value or null if the value is empty. * * @see #isEmpty(java.lang.Object) */ public static <T> T nullIfEmpty(T value) throws IOException { return isEmpty(value) ? null : value; }
@Override public JavaScriptInXhtmlAttributeEncoder append(char c, Appendable out) throws IOException { encodeJavaScriptInXhtmlAttribute(c, out); return this; }
@Override public JavaScriptInXhtmlEncoder append(CharSequence csq, int start, int end, Appendable out) throws IOException { encodeJavaScriptInXhtml(csq==null ? "null" : csq, start, end, out); return this; }
@Override public TextInXhtmlAttributeEncoder append(CharSequence csq, Appendable out) throws IOException { encodeTextInXhtmlAttribute(csq==null ? "null" : csq, out); return this; }
@Override public JavaScriptInXhtmlEncoder append(char c, Appendable out) throws IOException { encodeJavaScriptInXhtml(c, out); return this; }