Code example for Writer

Methods: write

0
    { 
        if (!writtenHtmlHead)
        { 
            writtenHtmlHead=true;
            completeSections(); 
            out.write("<html><head>");
            String title=(String)properties.get(Title);
            if (title!=null && title.length()>0 && !title.equals(NoTitle))
                out.write("<title>"+title+"</title>");
            head.write(out);
            out.write(base);
            out.write("\n</head>\n");
        } 
    } 
     
    /* ------------------------------------------------------------ */ 
    /** Write HTML page body tag. 
     * Write tags &ltBODY page attributes&gt. 
     */ 
    public void writeBodyTag(Writer out)
         throws IOException 
    { 
        if (!writtenBodyTag)
        { 
            writtenBodyTag = true;          
            out.write("<body "+attributes()+">\n");
        } 
    } 
 
    /* ------------------------------------------------------------ */ 
    /** Write end BODY and end HTML tags. 
     */ 
    public void writeHtmlEnd(Writer out)
         throws IOException 
    { 
        out.write("\n</body>\n");
        out.write("</html>\n");
    } 
     
    /* ------------------------------------------------------------ */ 
    /** Write any body elements of the page. 
     */ 
    public void writeElements(Writer out)
         throws IOException 
    { 
        super.write(out);
    } 
     
    /* ------------------------------------------------------------ */ 
    /** Write page section. 
     * The page is written containing only the named section. 
     * If a head and bodyTag have not been written, then they 
     * are written before the section. If endHtml is true, the 
     * end HTML tag is also written. 
     * If the named section is Content and it cannot be found, 
     * then the normal page contents are written. 
     */ 
    public void write(Writer out,
                      String section,
                      boolean endHtml)
         throws IOException 
    { 
        writeHtmlHead(out);
        writeBodyTag(out);
        Composite s = getSection(section);
        if (s==null)
        { 
            if (section.equals(Content))
                writeElements(out);
        } 
        else 
            s.write(out);
        if (endHtml)
            writeHtmlEnd(out);
        out.flush();
    } 
     
    /* ------------------------------------------------------------ */ 
    /* Flush the current contents of the page. 
     * writeHtmlEnd() is not called and should either be 
     * explicitly called or called via an eventual call to write() 
     */ 
    public void flush(Writer out)
         throws IOException 
    { 
        writeHtmlHead(out);
        writeBodyTag(out);
        super.flush(out);
    } 
     
    /* ------------------------------------------------------------ */ 
    /* Reset the page status to not written. 
     * This is useful if you want to send a page more than once. 
Contextual code suggestions in your IDE  Get Codota for Java