Coverage Report - com.quiotix.html.parser.HtmlDumper
 
Classes in this File Line Coverage Branch Coverage Complexity
HtmlDumper
0%
0/20
N/A
1
 
 1  
 /*
 2  
  * HtmlDumper.java -- Dumps an HTML document tree. 
 3  
  * Copyright (C) 1999 Quiotix Corporation.  
 4  
  *
 5  
  * This program is free software; you can redistribute it and/or modify
 6  
  * it under the terms of the GNU General Public License, version 2, as 
 7  
  * published by the Free Software Foundation.  
 8  
  *
 9  
  * This program is distributed in the hope that it will be useful,
 10  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  
  * GNU General Public License (http://www.gnu.org/copyleft/gpl.txt)
 13  
  * for more details.
 14  
  */
 15  
 
 16  
 package com.quiotix.html.parser;
 17  
 
 18  
 import java.io.OutputStream;
 19  
 import java.io.OutputStreamWriter;
 20  
 import java.io.PrintWriter;
 21  
 import java.io.UnsupportedEncodingException;
 22  
 
 23  
 /**
 24  
  * Simple HtmlVisitor which dumps out the document to the specified
 25  
  * output stream.
 26  
  *
 27  
  * @author Brian Goetz, Quiotix
 28  
  */
 29  
 
 30  
 public class HtmlDumper extends HtmlVisitor {
 31  
     protected PrintWriter out;
 32  
 
 33  
     /** Constructor. */
 34  0
     public HtmlDumper(OutputStream os) {
 35  0
         out = new PrintWriter(os);
 36  0
     }
 37  
 
 38  
     /** Constructor. */
 39  
     public HtmlDumper(OutputStream os, String encoding)
 40  0
             throws UnsupportedEncodingException {
 41  0
         out = new PrintWriter(new OutputStreamWriter(os, encoding));
 42  0
     }
 43  
 
 44  
     public void finish() {
 45  0
         out.flush();
 46  0
     }
 47  
 
 48  
     public void visit(HtmlDocument.Tag t) {
 49  0
         out.print(t);
 50  0
     }
 51  
 
 52  
     public void visit(HtmlDocument.EndTag t) {
 53  0
         out.print(t);
 54  0
     }
 55  
 
 56  
     public void visit(HtmlDocument.Comment c) {
 57  0
         out.print(c);
 58  0
     }
 59  
 
 60  
     public void visit(HtmlDocument.Text t) {
 61  0
         out.print(t);
 62  0
     }
 63  
 
 64  
     public void visit(HtmlDocument.Newline n) {
 65  0
         out.println();
 66  0
     }
 67  
 
 68  
     public void visit(HtmlDocument.Annotation a) {
 69  0
         out.print(a);
 70  0
     }
 71  
 }
 72