com.topologi.diffx.format
Class ShortStringFormatter

java.lang.Object
  extended bycom.topologi.diffx.format.ShortStringFormatter
All Implemented Interfaces:
DiffXFormatter

public final class ShortStringFormatter
extends Object
implements DiffXFormatter

A simple formatter to write the short string version of the events.

Version:
18 March 2005
Author:
Christophe Lauret

Constructor Summary
ShortStringFormatter()
          Creates a new formatter on the standard output.
ShortStringFormatter(Writer w)
          Creates a new formatter using the specified writer.
 
Method Summary
 void delete(DiffXEvent e)
          Writes the event as a short string preceded by '+'.
 void format(DiffXEvent e)
          Writes the event as a short string.
 void insert(DiffXEvent e)
          Writes the event as a short string preceded by '+'.
 void setConfig(DiffXConfig config)
          Ignored.
static String toShortString(DiffXEvent e)
          Returns the short string for the given event.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShortStringFormatter

public ShortStringFormatter()
                     throws IOException
Creates a new formatter on the standard output.

Throws:
IOException - should an I/O exception occurs.
See Also:
System.out

ShortStringFormatter

public ShortStringFormatter(Writer w)
                     throws IOException
Creates a new formatter using the specified writer.

Parameters:
w - The writer to use.
Throws:
IOException - should an I/O exception occurs.
Method Detail

format

public void format(DiffXEvent e)
            throws IOException,
                   IllegalStateException
Writes the event as a short string.

Specified by:
format in interface DiffXFormatter
Parameters:
e - The event to format
Throws:
IllegalStateException - If the formatter is not in a state to run this method.
IOException - Should an I/O exception occurs whilst formatting.
See Also:
DiffXFormatter.format(DiffXEvent)

insert

public void insert(DiffXEvent e)
            throws IOException,
                   IllegalStateException
Writes the event as a short string preceded by '+'.

Specified by:
insert in interface DiffXFormatter
Parameters:
e - The event to format
Throws:
IllegalStateException - If the formatter is not in a state to run this method.
IOException - Should an I/O exception occurs whilst formatting.
See Also:
DiffXFormatter.insert(DiffXEvent)

delete

public void delete(DiffXEvent e)
            throws IOException,
                   IllegalStateException
Writes the event as a short string preceded by '+'.

Specified by:
delete in interface DiffXFormatter
Parameters:
e - The event to format
Throws:
IOException - Should an I/O exception occurs whilst formatting.
IllegalStateException - If the formatter is not in a state to run this method.
See Also:
DiffXFormatter.delete(DiffXEvent)

setConfig

public void setConfig(DiffXConfig config)
Ignored.

Specified by:
setConfig in interface DiffXFormatter
Parameters:
config - The configuration to use.
See Also:
com.topologi.diffx.format.DiffXFormatter#setConfig(com.topologi.diffx.DiffXConfig)

toShortString

public static String toShortString(DiffXEvent e)
Returns the short string for the given event.

Parameters:
e - The event.
Returns:
The short string for the given event.