xbn.output
Class Outputter

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.output.Outputter
Direct Known Subclasses:
OSysDotOut

public class Outputter
extends XBNObject

Optionally output text to a variety of destinations, with configuration.

Source code:  Outputter.java

Use this in in any class that implements Debuggable. This Outputter class contains a single OWriter, and a single OConfig.


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
Outputter()
          Create an Outputter that does nothing.
Outputter(OWriter o_writer)
          Create an Outputter.
Outputter(OWriter o_writer, OConfig o_config)
          Create an Outputter.
 
Method Summary
 void actuallyWriteLine(String s_message, boolean b_useIndent, boolean b_newLine)
          Write a line of output to the destination.
 OConfig getOConfig()
          Get the OConfig object for direct manipulation.
 OWriter getOWriter()
          Get the OWriter object for direct manipulation.
 boolean isOn()
          Is this Outputter actually writing it's output?
 void newln()
          Write a newline to the destination.
 void setOConfig(OConfig o_config)
          Define the configuration for this Outputter.
 void setOWriter(OWriter o_writer)
          Define the destination for output.
 String toString()
          Get some information about this Ouptutter.
 void write(boolean b_useIndent, String s_message)
          Write a line of output to the destination.
 void write(String s_message)
          Write a line of output.
 void writeNoln(boolean b_useIndent, String s_message)
          Write a line of output to the destination.
 void writeNoln(String s_message)
          Write a line of output to the destination.
 
Methods inherited from class xbn.XBNObject
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Outputter

public Outputter()

Create an Outputter that does nothing.

Equal to Outputter((new OWEmpty()), (new OConfig()))


Outputter

public Outputter(OWriter o_writer)

Create an Outputter.

Equal to Outputter(o_writer, (new OConfig(true)))


Outputter

public Outputter(OWriter o_writer,
                 OConfig o_config)

Create an Outputter.

Parameters:
o_writer - Declares the output destination. May not be null. See setOWriter and getOWriter.
o_config - The configuration for this Outputter object. May not be null. See setOConfig and getOConfig.
Method Detail

getOWriter

public final OWriter getOWriter()

Get the OWriter object for direct manipulation.

Set with setOWriter.


getOConfig

public final OConfig getOConfig()

Get the OConfig object for direct manipulation.

Set with setOConfig.


setOWriter

public final void setOWriter(OWriter o_writer)

Define the destination for output.

Get with getOWriter.

Parameters:
o_writer - Object declaring the output destination. May not be null.

setOConfig

public final void setOConfig(OConfig o_config)

Define the configuration for this Outputter.

Get with getOConfig.

Parameters:
o_config - The configuration for this Outputter object. May not be null.

isOn

public final boolean isOn()

Is this Outputter actually writing it's output?

Note that this setting is ignored when the OWriter is not active.

Returns:
getOConfig().isOn()

write

public final void write(String s_message)

Write a line of output.

Equal to actuallyWriteLine(s_message, true, true)


writeNoln

public final void writeNoln(String s_message)

Write a line of output to the destination.

Equal to actuallyWriteLine(s_message, false, false)


newln

public final void newln()

Write a newline to the destination.

Equal to actuallyWriteLine(null, false, true)


write

public final void write(boolean b_useIndent,
                        String s_message)

Write a line of output to the destination.

Equal to actuallyWriteLine(s_message, b_useIndent, true)


writeNoln

public final void writeNoln(boolean b_useIndent,
                            String s_message)

Write a line of output to the destination.

Equal to actuallyWriteLine(s_message, b_useIndent, false)


actuallyWriteLine

public void actuallyWriteLine(String s_message,
                              boolean b_useIndent,
                              boolean b_newLine)

Write a line of output to the destination.

What is done in this function?

In order:

  1. If either getOWriter.isActive() or getOConfig().isOn() equal false, do nothing. DONE.
  2. If s_message is null and b_newLine is true, then call getOWriter().newln(). DONE.
  3. Format the message (using getOConfig().getFormatted(b_useIndent, s_message)), and then output it via getOWriter().write or getOWriter().writeNoln.

Parameters:
s_message - The message to output.
b_useIndent - Should this line of output be preceded by an indentation? If true, yes, indent. If false, no indent.
b_newLine - If true, output using OWriter.write. If false, use OWriter.writeNoln.

toString

public final String toString()

Get some information about this Ouptutter.

Overrides:
toString in class Object



Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.

 

http://sourceforge.net/projects/xbnjava

 

SourceForge.net Logo