org.qedeq.base.io
Class AbstractOutput

java.lang.Object
  extended by org.qedeq.base.io.AbstractOutput
Direct Known Subclasses:
StringOutput, TextOutput

public abstract class AbstractOutput
extends java.lang.Object

Wraps a text output stream.

Author:
Michael Meyling

Constructor Summary
AbstractOutput()
          Constructor.
 
Method Summary
 void addToken(java.lang.String part)
          Append token to output.
 void addWs(java.lang.String ws)
          Add whitespace to output.
abstract  void append(java.lang.String text)
          Append text directly to output device.
 void clearLevel()
          Reset tab level to zero.
 int columnsLeft()
          How many columns have we left?
 void flush()
          Flush output.
 int getColumns()
          Return number of maximum columns.
 java.lang.String getLevel()
          Return current tab string.
abstract  long getPosition()
          Get writing position.
 void popLevel()
          Decrement tab level.
 void popLevel(int characters)
          Decrement tab level.
 void print(char c)
          Print character to output.
 void print(java.lang.Object object)
          Print object to output.
 void print(java.lang.String text)
          Print text and split at white space if text doesn't fit within maximum column size.
 void println()
          Print new line to output.
 void println(java.lang.Object object)
          Print object and new line to output.
 void println(java.lang.String token)
          Print spaces text and new line to output.
 void printWithoutSplit(java.lang.String text)
          Print spaces and text to output.
 void pushLevel()
          Increment tab level (this are two spaces).
 void pushLevel(java.lang.String symbols)
          Increment tab level with following symbols.
 void setColumns(int columns)
          Set number of maximum columns.
 void setLevel(java.lang.String level)
          Set current tab string.
 void setTabLevel()
          Set current tab level to current level.
 void skipToColumn(int column)
          Skip until given column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractOutput

public AbstractOutput()
Constructor.

Method Detail

addWs

public void addWs(java.lang.String ws)
Add whitespace to output.

Parameters:
ws - Add this whitespace.

addToken

public void addToken(java.lang.String part)
Append token to output.

Parameters:
part - Add this part.

flush

public void flush()
Flush output.


print

public void print(char c)
Print character to output.

Parameters:
c - Append this.

print

public void print(java.lang.String text)
Print text and split at white space if text doesn't fit within maximum column size. Also flushes output.

Parameters:
text - Append this.

append

public abstract void append(java.lang.String text)
Append text directly to output device.

Parameters:
text - Append this text.

getPosition

public abstract long getPosition()
Get writing position.

Returns:
Writing position.

printWithoutSplit

public void printWithoutSplit(java.lang.String text)
Print spaces and text to output.

Parameters:
text - Append this.

columnsLeft

public int columnsLeft()
How many columns have we left?

Returns:
Columns left. Returns -1 if there is no limit.

print

public void print(java.lang.Object object)
Print object to output.

Parameters:
object - Append text representation of this.

println

public final void println(java.lang.String token)
Print spaces text and new line to output.

Parameters:
token - Append this.

println

public final void println(java.lang.Object object)
Print object and new line to output.

Parameters:
object - Append text representation of this.

println

public void println()
Print new line to output.


skipToColumn

public void skipToColumn(int column)
Skip until given column. To do this we append spaces.

Parameters:
column - Skip to this column.

clearLevel

public final void clearLevel()
Reset tab level to zero.


popLevel

public final void popLevel()
Decrement tab level.


popLevel

public final void popLevel(int characters)
Decrement tab level.

Parameters:
characters - Number of characters to reduce from tab level.

getLevel

public final java.lang.String getLevel()
Return current tab string.

Returns:
Current tab string.

setLevel

public final void setLevel(java.lang.String level)
Set current tab string.

Parameters:
level - Tab string.

pushLevel

public final void pushLevel()
Increment tab level (this are two spaces).


pushLevel

public final void pushLevel(java.lang.String symbols)
Increment tab level with following symbols.

Parameters:
symbols - Symbols to tab width. Length should be exactly 2 characters!

setTabLevel

public final void setTabLevel()
Set current tab level to current level. Might change unwritten lines.


setColumns

public void setColumns(int columns)
Set number of maximum columns. If possible we break before we reach this column number. If less or equal to zero no line breaking is done automatically.

Parameters:
columns - Maximum column size.

getColumns

public final int getColumns()
Return number of maximum columns. If equal to zero no line breaking is done automatically.

Returns:
Maximum column size.


Copyright © 2014. All Rights Reserved.