gnu.text

Class WriterManager

Implemented Interfaces:
Runnable

public class WriterManager
extends java.lang.Object
implements Runnable

Manages a collection of Writers, handling automatic closing. This class is useful for making sure that a Writer is 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

Method Summary

gnu.text.WriterRef
register(Writer port)
Register a Writer.
boolean
registerShutdownHook()
Try to register this as a shutdown hook.
void
run()
void
unregister(Object key)
Unregister a Writer.

Field Details

instance

public static final WriterManager instance

Method Details

register

public gnu.text.WriterRef register(Writer port)
Register a Writer.

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).

run

public void run()

unregister

public void unregister(Object key)
Unregister a Writer.