net.sourceforge.scopes.rewriters.impl
Class SimpleWriteNodeVisitor

java.lang.Object
  extended by org.htmlparser.visitors.NodeVisitor
      extended by net.sourceforge.scopes.rewriters.NodeVisitorWithResult
          extended by net.sourceforge.scopes.rewriters.impl.SimpleWriteNodeVisitor
All Implemented Interfaces:
ContextPathUser

public class SimpleWriteNodeVisitor
extends NodeVisitorWithResult

Node visitor that can write original, additional and rewritten code.


Field Summary
protected  java.io.ByteArrayOutputStream afterBaos
          OutputStreams
protected  java.io.PrintWriter afterVisitWriter
          PrintWriters
protected  java.io.ByteArrayOutputStream baos
          OutputStreams
protected  java.io.ByteArrayOutputStream beforeBaos
          OutputStreams
protected  java.io.PrintWriter beforeVisitWriter
          PrintWriters
protected  java.lang.String charset
           
protected  java.io.PrintWriter writer
          PrintWriters
 
Constructor Summary
SimpleWriteNodeVisitor()
          Constructor.
SimpleWriteNodeVisitor(boolean recurseChildren)
          Constructor.
SimpleWriteNodeVisitor(boolean recurseChildren, boolean recurseSelf)
          Constructor.
 
Method Summary
 void beginParsing()
           
 void finishedParsing()
           
 java.io.PrintWriter getAfterVisitWriter()
          Returns a writer that can be used to add code after the currently visited node.
 java.io.PrintWriter getBeforeVisitWriter()
          Returns a writer that can be used to add code before the currently visited node.
 byte[] getResult()
          Returns the result as an array of byte, encoded with the given character set.
 void setCharset(java.lang.String charset)
          Sets the character set to use.
 void setContextPath(java.lang.String contextPath)
          Sets the context path to refer to.
 boolean shouldRecurseChildren()
           
 boolean shouldRecurseSelf()
           
 void visitEndTag(org.htmlparser.Tag tag)
           
 void visitRemarkNode(org.htmlparser.Remark remark)
           
 void visitStringNode(org.htmlparser.Text string)
           
 void visitTag(org.htmlparser.Tag tag)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baos

protected java.io.ByteArrayOutputStream baos
OutputStreams


beforeBaos

protected java.io.ByteArrayOutputStream beforeBaos
OutputStreams


afterBaos

protected java.io.ByteArrayOutputStream afterBaos
OutputStreams


writer

protected java.io.PrintWriter writer
PrintWriters


beforeVisitWriter

protected java.io.PrintWriter beforeVisitWriter
PrintWriters


afterVisitWriter

protected java.io.PrintWriter afterVisitWriter
PrintWriters


charset

protected java.lang.String charset
Constructor Detail

SimpleWriteNodeVisitor

public SimpleWriteNodeVisitor()
Constructor.


SimpleWriteNodeVisitor

public SimpleWriteNodeVisitor(boolean recurseChildren,
                              boolean recurseSelf)
Constructor.

Parameters:
recurseChildren - true to recurse children.
recurseSelf - true to recurse itself.

SimpleWriteNodeVisitor

public SimpleWriteNodeVisitor(boolean recurseChildren)
Constructor.

Parameters:
recurseChildren - true to recurse children.
Method Detail

beginParsing

public void beginParsing()
Overrides:
beginParsing in class org.htmlparser.visitors.NodeVisitor

finishedParsing

public void finishedParsing()
Overrides:
finishedParsing in class org.htmlparser.visitors.NodeVisitor

shouldRecurseChildren

public boolean shouldRecurseChildren()
Overrides:
shouldRecurseChildren in class org.htmlparser.visitors.NodeVisitor

shouldRecurseSelf

public boolean shouldRecurseSelf()
Overrides:
shouldRecurseSelf in class org.htmlparser.visitors.NodeVisitor

visitEndTag

public void visitEndTag(org.htmlparser.Tag tag)
Overrides:
visitEndTag in class org.htmlparser.visitors.NodeVisitor

visitRemarkNode

public void visitRemarkNode(org.htmlparser.Remark remark)
Overrides:
visitRemarkNode in class org.htmlparser.visitors.NodeVisitor

visitStringNode

public void visitStringNode(org.htmlparser.Text string)
Overrides:
visitStringNode in class org.htmlparser.visitors.NodeVisitor

visitTag

public void visitTag(org.htmlparser.Tag tag)
Overrides:
visitTag in class org.htmlparser.visitors.NodeVisitor

setContextPath

public void setContextPath(java.lang.String contextPath)
Description copied from interface: ContextPathUser
Sets the context path to refer to.

Specified by:
setContextPath in interface ContextPathUser
Specified by:
setContextPath in class NodeVisitorWithResult
Parameters:
contextPath - The context path.

setCharset

public void setCharset(java.lang.String charset)
Description copied from class: NodeVisitorWithResult
Sets the character set to use.

Specified by:
setCharset in class NodeVisitorWithResult
Parameters:
charset - The character set.

getBeforeVisitWriter

public java.io.PrintWriter getBeforeVisitWriter()
Description copied from class: NodeVisitorWithResult
Returns a writer that can be used to add code before the currently visited node.

Specified by:
getBeforeVisitWriter in class NodeVisitorWithResult
Returns:
The writer to write before the node.

getAfterVisitWriter

public java.io.PrintWriter getAfterVisitWriter()
Description copied from class: NodeVisitorWithResult
Returns a writer that can be used to add code after the currently visited node.

Specified by:
getAfterVisitWriter in class NodeVisitorWithResult
Returns:
The writer to write after the node.

getResult

public byte[] getResult()
Description copied from class: NodeVisitorWithResult
Returns the result as an array of byte, encoded with the given character set.

Specified by:
getResult in class NodeVisitorWithResult
Returns:
The result.