tribble.io
Interface SuspendableWriterI

All Known Subinterfaces:
DebugWriterI
All Known Implementing Classes:
DebugWriter, DiagnosticOutputDfl, Logger, SuspendablePrintWriter, SuspendableWriter

public interface SuspendableWriterI

A character output stream that can be suspended and resumed.

This interface is used to implement any kind of character output stream that is capable of writing output (e.g., Writer). It also provides the capability of suspending all output written to the stream, so that subsequent write requests perform no output. It also provides the capability of resuming all output written to the stream.

Implementations of this interface are encouraged to provide at least one constructor that takes an output stream argument (such as a Writer or OutputStream) specifying the underlying character output stream. For example:

    class MySuspendableOutput
        extends tribble.io.SuspendableWriterI
    {
        /** Constructor. */
        public MySuspendableOutput(java.io.Writer out)
        { ... }

        ...
    } 

Since:
2001-06-21
Version:
$Revision: 1.3 $ $Date: 2003/02/01 17:30:03 $
Author:
David R. Tribble, david@tribble.com.
Copyright 2001-2003 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code provided that the original copyright and authorship notices remain intact.
See Also:
SuspendableWriter, SuspendablePrintWriter, DebugWriterI

Field Summary
static java.lang.String REV
          Revision information.
 
Method Summary
 void close()
          Close this output stream.
 boolean isSuspended()
          Determine if this output stream is suspended or not.
 void resume()
          Resume subsequent output written to this output stream.
 void suspend()
          Suspend subsequent output written to this output stream.
 

Field Detail

REV

static final java.lang.String REV
Revision information.

See Also:
Constant Field Values
Method Detail

suspend

void suspend()
Suspend subsequent output written to this output stream.

Output to this stream can be resumed by calling resume().

This method may be called multiple times without any intervening call to resume() without any ill effects.

Since:
1.1, 2001-06-21
See Also:
resume()

resume

void resume()
Resume subsequent output written to this output stream.

Output to this stream can be suspended by calling suspend().

This method may be called multiple times without any previous or intervening call to suspend() without any ill effects.

Since:
1.1, 2001-06-21
See Also:
suspend()

isSuspended

boolean isSuspended()
Determine if this output stream is suspended or not.

Returns:
True if this output stream is currently suspended, otherwise false.
Since:
1.1, 2001-09-01
See Also:
suspend()

close

void close()
           throws java.io.IOException
Close this output stream.

Note that this method is required to flush and close the underlying output stream of this stream. It does this regardless of whether or not this stream is suspended.

Throws:
java.io.IOException - Thrown if an error occurs.
Since:
1.3, 2003-02-01