Code example for Writer

Methods: write

0
    public HtmlWriter(Writer writer) {
        this.writer = writer;
    } 
 
    public void title(String title) throws IOException {
        writer.write("<html>");
        writer.write("<head>");
        writer.write("<title>" + title + "</title>");
        writer.write("</head>");
        writer.write("<body>\n");
        writer.write("<h1>" + title + "</h1>\n");
    } 
 
    public void paragraph(String msg) throws IOException {
        writer.write("<p>" + msg + "</p>\n");
    } 
 
    public void link(String href, String caption) throws IOException {
        paragraph("<a href=\"" + href + "\">" + caption + "</a>");
    }