⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xulresponsewriter.java

📁 一个比较好的jsf spring hibernate的例子
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            }        } else {            writer.write(" ");            writer.write(name);            writer.write("=\"");            // write the attribute value            Util.writeAttribute(writer, buffer, value.toString());            writer.write("\"");        }    }    /**     * <p>Write a properly encoded URI attribute name and the corresponding     * value. The value text will be converted to a String if necessary).     * This method may only be called after a call to     * <code>startElement()</code>, and before the opened element has been     * closed.</p>     *     * @param name                  Attribute name to be added     * @param value                 Attribute value to be added     * @param componentPropertyName The name of the component property to     *                              which this attribute argument applies.  This argument may be     *                              <code>null</code>.     *     * @throws IllegalStateException if this method is called when there     *                               is no currently open element     * @throws IOException           if an input/output error occurs     * @throws NullPointerException  if <code>name</code> or     *                               <code>value</code> is <code>null</code>     */    public void writeURIAttribute(String name, Object value,                                  String componentPropertyName)          throws IOException {        if (name == null || value == null) {            // PENDING i18n            throw new NullPointerException(                  "Argument Error: One or more parameters are null.");        }        writer.write(" ");        writer.write(name);        writer.write("=\"");        String strValue = value.toString(); //TODO: Use converter for value?        writer.write(' ');        writer.write(name);        writer.write("=\"" + strValue + "\"");    }    /**     * <p>Write a comment string containing the specified text.     * The text will be converted to a String if necessary.     * If there is an open element that has been created by a call     * to <code>startElement()</code>, that element will be closed     * first.</p>     *     * @param comment Text content of the comment     *     * @throws IOException          if an input/output error occurs     * @throws NullPointerException if <code>comment</code>     *                              is <code>null</code>     */    public void writeComment(Object comment) throws IOException {        if (comment == null) {            // PENDING i18n            throw new NullPointerException(                  "Argument Error: One or more parameters are null.");        }        closeStartIfNecessary();        writer.write("<!-- ");        writer.write(comment.toString());        writer.write(" -->");    }    /**     * <p>Write a properly escaped object. The object will be converted     * to a String if necessary.  If there is an open element     * that has been created by a call to <code>startElement()</code>,     * that element will be closed first.</p>     *     * @param text                  Text to be written     * @param componentPropertyName The name of the component property to     *                              which this text argument applies.  This argument may be <code>null</code>.     *     * @throws IOException          if an input/output error occurs     * @throws NullPointerException if <code>text</code>     *                              is <code>null</code>     */    public void writeText(Object text, String componentPropertyName)          throws IOException {        if (text == null) {            // PENDING i18n            throw new NullPointerException(                  "Argument Error: One or more parameters are null.");        }        closeStartIfNecessary();        if (dontEscape) {            writer.write(text.toString());        } else {            Util.writeText(writer, buffer, text.toString());        }    }    /**     * <p>Write a properly escaped single character, If there     * is an open element that has been created by a call to     * <code>startElement()</code>, that element will be closed first.</p>     * <p/>     * <p>All angle bracket occurrences in the argument must be escaped     * using the &amp;gt; &amp;lt; syntax.</p>     *     * @param text Text to be written     *     * @throws IOException if an input/output error occurs     */    public void writeText(char text) throws IOException {        closeStartIfNecessary();        if (dontEscape) {            writer.write(text);        } else {            charHolder[0] = text;            Util.writeText(writer, buffer, charHolder);        }    }    /**     * <p>Write properly escaped text from a character array.     * The output from this command is identical to the invocation:     * <code>writeText(c, 0, c.length)</code>.     * If there is an open element that has been created by a call to     * <code>startElement()</code>, that element will be closed first.</p>     * </p>     * <p/>     * <p>All angle bracket occurrences in the argument must be escaped     * using the &amp;gt; &amp;lt; syntax.</p>     *     * @param text Text to be written     *     * @throws IOException          if an input/output error occurs     * @throws NullPointerException if <code>text</code>     *                              is <code>null</code>     */    public void writeText(char text[]) throws IOException {        if (text == null) {            // PENDING i18n            throw new NullPointerException(                  "Argument Error: One or more parameters are null.");        }        closeStartIfNecessary();        if (dontEscape) {            writer.write(text);        } else {            Util.writeText(writer, buffer, text);        }    }    /**     * <p>Write properly escaped text from a character array.     * If there is an open element that has been created by a call     * to <code>startElement()</code>, that element will be closed     * first.</p>     * <p/>     * <p>All angle bracket occurrences in the argument must be escaped     * using the &amp;gt; &amp;lt; syntax.</p>     *     * @param text Text to be written     * @param off  Starting offset (zero-relative)     * @param len  Number of characters to be written     *     * @throws IndexOutOfBoundsException if the calculated starting or     *                                   ending position is outside the bounds of the character array     * @throws IOException               if an input/output error occurs     * @throws NullPointerException      if <code>text</code>     *                                   is <code>null</code>     */    public void writeText(char text[], int off, int len)          throws IOException {        if (text == null) {            // PENDING i18n            throw new NullPointerException(                  "Argument Error: One or more parameters are null.");        }        if (off < 0 || off > text.length || len < 0 || len > text.length) {            throw new IndexOutOfBoundsException();        }        closeStartIfNecessary();        if (dontEscape) {            writer.write(text, off, len);        } else {            Util.writeText(writer, buffer, text, off, len);        }    }    /**     * <p>Create a new instance of this <code>ResponseWriter</code> using     * a different <code>Writer</code>.     *     * @param writer The <code>Writer</code> that will be used to create     *               another <code>ResponseWriter</code>.     */    public ResponseWriter cloneWithWriter(Writer writer) {        try {            return new XULResponseWriter(writer, getContentType(),                                         getCharacterEncoding());        } catch (FacesException e) {            // This should never happen            throw new IllegalStateException();        }    }    /**     * This method automatically closes a previous element (if not     * already closed).     */    private void closeStartIfNecessary() throws IOException {        if (closeStart) {            writer.write(">");            closeStart = false;        }    }    /** Methods From <code>java.io.Writer</code> */    public void close() throws IOException {        closeStartIfNecessary();        writer.close();    }    public void write(char cbuf) throws IOException {        closeStartIfNecessary();        writer.write(cbuf);    }    public void write(char[] cbuf, int off, int len) throws IOException {        closeStartIfNecessary();        writer.write(cbuf, off, len);    }    public void write(int c) throws IOException {        closeStartIfNecessary();        writer.write(c);    }    public void write(String str) throws IOException {        closeStartIfNecessary();        writer.write(str);    }    public void write(String str, int off, int len) throws IOException {        closeStartIfNecessary();        writer.write(str, off, len);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -