gnu.text
Class WriterManager
java.lang.Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
instance
public static WriterManager instance
WriterManager
public WriterManager()
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).