org.hydrateframework.gen
Class LangWriter

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by org.hydrateframework.gen.LangWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class LangWriter
extends java.io.PrintStream

Version:
@(#)$Revision: 1.3 $
Author:
David Chamberlin The LangWriter is a PrintStream modified to interpret the data passed to it in a way that is useful for writing formatted code. The class overrides print(String) and println(String) and converts special escape sequences to have special formatting effects. See the definition of print(String) for details.

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
LangWriter(java.io.OutputStream out)
          Construct a LangWriter that will output to the given output stream.
LangWriter(java.io.OutputStream out, boolean autoFlush)
          Construct a LangWriter with autoFlush.
LangWriter(java.io.OutputStream out, LangWriter basedOn)
          Construct a LangWriter that will output to the given output stream.
 
Method Summary
protected  void addListSep(java.lang.StringBuffer sb)
           
 void closeCmt()
          This call can be used to terminate a comment block.
 void comment(java.lang.String s)
          Write a single line style comment.
 void docCmt(java.lang.String s)
          Write a document comment.
 java.lang.String getWrittenString()
           
protected  java.lang.String parseString(java.lang.String s)
           
 void print(java.lang.String s)
           
 void println(java.lang.String s)
           
 void startList(java.lang.String sep)
           
protected  void tabIn()
           
protected  void tabOut()
           
 
Methods inherited from class java.io.PrintStream
append, append, append, checkError, close, flush, format, format, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, setError, write, write
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LangWriter

public LangWriter(java.io.OutputStream out,
                  LangWriter basedOn)
Construct a LangWriter that will output to the given output stream.

Parameters:
out - The output stream to send formatted output to.

LangWriter

public LangWriter(java.io.OutputStream out)
Construct a LangWriter that will output to the given output stream.

Parameters:
out - The output stream to send formatted output to.

LangWriter

public LangWriter(java.io.OutputStream out,
                  boolean autoFlush)
Construct a LangWriter with autoFlush.

Parameters:
out - The output stream to send formatted output to
Method Detail

getWrittenString

public java.lang.String getWrittenString()

docCmt

public void docCmt(java.lang.String s)
Write a document comment. This is useful when the LangWriter is being used to write java code. Doc comments should be used before class, attribute and method definitions and are interpreted by the javadoc compiler to produce documentation for a class. The text sent to this call will be automatically formatted as per the standard for javadoc comments. The method handles work wrap automatically - you do not need to insert any '\n' characters and the code automatically inserts a single space between each line of text sent. If you do put in a '\n' character then this will force a new line within the comment. The open and close comment for doc-comments is handled automatically when you switch between comments and normal output. For example:
lw.docCmt("The following method performs some function that"); lw.docCmt("is <b>vital </b> to the operation of the class."); lw.docCmt("\n&at;param in an input parameter"); lw.print("void do(String in) {");
might produce the following output:
&sl;** * The following method performs some function * that is <b>vital</b> to the * operation of the class. * &at;param in an input parameter *&sl; void do(String in) {
see the javadoc documentation for details of the format of doc comments.

Parameters:
s - the next 'line' of text to be used as a comment. Successive calls treat all text as a single block which will be word wrapped depending on available space.

comment

public void comment(java.lang.String s)
Write a single line style comment. This is useful when the LangWriter is being used to write java, C++ or any other code that supports this style of comment. The method handles work wrap automatically - you do not need to insert any '\n' characters and the code automatically inserts a single space between each line of text sent. If you do put in a '\n' character then this will force a new line within the comment. The open and close comment for doc-comments is handled automatically when you switch between comments and normal output.

Parameters:
s - the next 'line' of text to be used as a comment. Successive calls treat all text as a single block which will be word wrapped depending on available space.

closeCmt

public void closeCmt()
This call can be used to terminate a comment block. It is rarely needed since termination will normally happen automatically when you switch back to normal text.


print

public void print(java.lang.String s)
Overrides:
print in class java.io.PrintStream

println

public void println(java.lang.String s)
Overrides:
println in class java.io.PrintStream

parseString

protected java.lang.String parseString(java.lang.String s)

startList

public void startList(java.lang.String sep)

addListSep

protected void addListSep(java.lang.StringBuffer sb)

tabOut

protected void tabOut()

tabIn

protected void tabIn()


Copyright © 2000 The Hydrate Project. All Rights Reserved.