gnu.text
Class WriterManager

java.lang.Object
  extended by gnu.text.WriterManager
All Implemented Interfaces:
java.lang.Runnable

public class WriterManager
extends java.lang.Object
implements java.lang.Runnable

Manages a collection of Writers, handling automatic closing. This class is useful for making sure that a Writer closed (and its buffers flushed) when a VM exits. A WriterManager can be usefully passed to the JDK 1.3 method addShutdownHook in Runtime.


Field Summary
static WriterManager instance
           
 
Constructor Summary
WriterManager()
           
 
Method Summary
 int register(java.io.Writer port)
           
 boolean registerShutdownHook()
          Try to register this as a shutdown hook.
 void run()
           
 void unregister(int index)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static WriterManager instance
Constructor Detail

WriterManager

public WriterManager()
Method Detail

register

public int register(java.io.Writer port)

unregister

public void unregister(int index)

run

public void run()
Specified by:
run in interface java.lang.Runnable

registerShutdownHook

public boolean registerShutdownHook()
Try to register this as a shutdown hook.

Returns:
true on success; false if failure (e.g. if not JDK1.3-compatible).