|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EDU.bmrb.starlibj.StarUnparser
The inverse of class StarParse: This class will print out a star file (or subset thereof) into a previously opened output stream. Many of the output options can be manipulated with get... and set... functions.
This class is thread-safe if and only if each thread that uses it has its own separate instances of this class. (There are no static entities that step on each other in this class, so each instance of it is independant, but there are some dynamic entities that do get in each other's way if multiple threads try to run methods in the same object.)
Field Summary | |
protected boolean |
formatting
|
protected int |
indentSize
|
protected java.io.PrintWriter |
oWrit
|
protected int |
prevCheckLineNum
|
protected SkipTextHandler |
skips
|
Constructor Summary | |
StarUnparser(java.io.OutputStream out)
Constructor: Pass in an already-opened output stream and the output will end up there - buffered. |
|
StarUnparser(java.io.OutputStream out,
boolean autoFlush)
Constructor: Pass in an already-opened output stream and the output will end up there - and choose the flushing flag. |
|
StarUnparser(StarUnparser copyMe)
copy constructor: copies an existing StarUnparser object: |
Method Summary | |
StarUnparser |
clone(StarUnparser copyMe)
clone - needed so that this type can be stored inside the container classes in java.util.*. |
protected void |
finalize()
Flush the output one last time before ending. |
boolean |
getFormatting()
Gets the value of current formatting flag. |
int |
getIndentSize()
Gets the number of characters to indent when printing. |
protected boolean |
isItNumeric(java.lang.String str)
|
void |
setFormatting(boolean isOn)
Turns off (or on) the formatting code for output. |
void |
setIndentSize(int s)
Sets the number of characters to indent when printing. |
protected void |
writeBlockNode(BlockNode node,
int indentLvl)
|
protected void |
writeDataItemNode(DataItemNode node,
int indentLvl,
int longest)
|
protected void |
writeDataLoopNameListNode(DataLoopNameListNode node,
int indentLvl)
|
protected void |
writeDataLoopNode(DataLoopNode node,
int indentLvl)
|
protected void |
writeDataNameNode(DataNameNode node,
int indentLvl)
|
protected void |
writeDataValueNode(DataValueNode node,
int indentLvl,
int preSize,
int postSize)
|
protected void |
writeIndent(int indentLvl)
|
protected void |
writeLoopNameListNode(LoopNameListNode node,
int indentLvl)
|
protected void |
writeLoopRowNode(LoopRowNode node,
int indentLvl,
java.util.Vector preSizes,
java.util.Vector postSizes)
|
protected void |
writeLoopTableNode(LoopTableNode node,
int indentLvl)
|
void |
writeOut(StarNode node,
int indentLvl)
Writes out the StarNode-derived object given. |
protected void |
writeOut(StarNode node,
int indentLvl,
boolean internal)
|
protected void |
writeOut(StarNode node,
int indentLvl,
int longest)
Writes out the StarNode-derived object given. |
protected void |
writeOut(StarNode node,
int indentLvl,
int longest,
boolean internal)
|
protected void |
writePreComment(java.lang.String cmt,
int indentLvl)
|
protected void |
writeSaveFrameNode(SaveFrameNode node,
int indentLvl)
|
void |
writeSkipped(int thisLineNum)
writeSkipped - writes out the skipped text that may exist between the last written thing and the current written thing: |
protected void |
writeStarFileNode(StarFileNode node,
int indentLvl)
|
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected int indentSize
protected boolean formatting
protected java.io.PrintWriter oWrit
protected SkipTextHandler skips
protected int prevCheckLineNum
Constructor Detail |
public StarUnparser(java.io.OutputStream out)
out
- The output stream to print on.public StarUnparser(java.io.OutputStream out, boolean autoFlush)
out
- The output stream to print on.autoFlush
- true = flush each line, false = don't
flush output on each line. Setting it false
is the default.public StarUnparser(StarUnparser copyMe)
Method Detail |
protected void finalize()
public StarUnparser clone(StarUnparser copyMe)
public void writeSkipped(int thisLineNum)
public void writeOut(StarNode node, int indentLvl)
node
- The StarNode to print out.indentLvl
- The starting indent level tolongest
- The longest string in the value.
print at, typically zero. The number of characters
indented will be = (indentLvl * getIndentSize()).setIndentSize()
protected void writeOut(StarNode node, int indentLvl, int longest)
node
- The StarNode to print out.indentLvl
- The starting indent level tolongest
- The longest string in the value.
print at, typically zero. The number of characters
indented will be = (indentLvl * getIndentSize()).setIndentSize()
protected void writeOut(StarNode node, int indentLvl, boolean internal)
protected void writeOut(StarNode node, int indentLvl, int longest, boolean internal)
protected void writeIndent(int indentLvl)
protected void writePreComment(java.lang.String cmt, int indentLvl)
protected void writeDataValueNode(DataValueNode node, int indentLvl, int preSize, int postSize)
protected void writeDataNameNode(DataNameNode node, int indentLvl)
protected void writeDataItemNode(DataItemNode node, int indentLvl, int longest)
protected void writeDataLoopNode(DataLoopNode node, int indentLvl)
protected void writeDataLoopNameListNode(DataLoopNameListNode node, int indentLvl)
protected void writeLoopNameListNode(LoopNameListNode node, int indentLvl)
protected void writeLoopTableNode(LoopTableNode node, int indentLvl)
protected void writeLoopRowNode(LoopRowNode node, int indentLvl, java.util.Vector preSizes, java.util.Vector postSizes)
protected void writeSaveFrameNode(SaveFrameNode node, int indentLvl)
protected void writeBlockNode(BlockNode node, int indentLvl)
protected void writeStarFileNode(StarFileNode node, int indentLvl)
public void setIndentSize(int s)
public int getIndentSize()
public void setFormatting(boolean isOn)
One example of a place where this could be useful is when two programs are communicating using STAR syntax over a pipe or socket.
isOn
- true (default) == formatting is on, false == turn
formatting off.public boolean getFormatting()
setFormatting
protected boolean isItNumeric(java.lang.String str)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |