|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Writer tribble.io.SuspendableWriter
public class SuspendableWriter
A character output stream that can be suspended and resumed.
This is a default implementation of a character output stream that can be
suspended and resumed (see SuspendableWriterI
), based on the standard
Writer
class. It provides the capability of suspending all
output written to the stream, so that subsequent write requests perform no
output. It also has the capability of resuming all output written to the
stream.
Writer
Field Summary | |
---|---|
protected static java.lang.String |
EXCEPT_CLOSED
Exception text contents for a closed output stream. |
protected java.io.Writer |
m_out
Underlying output stream. |
protected java.io.Writer |
m_sus
Suspended underlying output stream. |
(package private) static java.lang.String |
REV
Revision information. |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
SuspendableWriter()
Constructor. |
|
SuspendableWriter(java.io.Writer out)
Constructor. |
Method Summary | |
---|---|
void |
close()
Closes this output stream. |
protected void |
finalize()
Finalization. |
void |
flush()
Flushes any pending output to the output stream. |
java.io.Writer |
getOutput()
Retrieves the underlying output stream to which all output for this stream is written. |
boolean |
isSuspended()
Determines if this output stream is suspended or not. |
void |
resume()
Resumes subsequent output written to this output stream. |
void |
setOutput(java.io.Writer out)
Establishes the underlying output stream to which all output for this stream is written. |
void |
suspend()
Suspends subsequent output written to this output stream. |
void |
write(char[] cbuf)
Writes the contents of a character array to this output stream. |
void |
write(char[] cbuf,
int off,
int len)
Writes a portion of a character array to this output stream. |
void |
write(int c)
Writes a single character to this output stream. |
void |
write(java.lang.String str)
Writes the contents of a string to this output stream. |
void |
write(java.lang.String str,
int off,
int len)
Writes a subset of a string to this output stream. |
Methods inherited from class java.io.Writer |
---|
append, append, append |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final java.lang.String REV
protected static final java.lang.String EXCEPT_CLOSED
protected java.io.Writer m_out
protected java.io.Writer m_sus
Constructor Detail |
---|
public SuspendableWriter()
public SuspendableWriter(java.io.Writer out)
out
- The underlying output stream for this stream.Method Detail |
---|
public void suspend()
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.
suspend
in interface SuspendableWriterI
resume()
public void resume()
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.
resume
in interface SuspendableWriterI
suspend()
public boolean isSuspended()
isSuspended
in interface SuspendableWriterI
suspend()
public void close() throws java.io.IOException
Note that this method is required to flush and close the underlying output stream of this stream. Any writes subsequent to closing this stream should throw an IOException exception.
close
in interface java.io.Closeable
close
in interface SuspendableWriterI
close
in class java.io.Writer
java.io.IOException
- Thrown if an output error occurs.public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
- Thrown if an output error occurs.public void write(char[] cbuf) throws java.io.IOException
write
in class java.io.Writer
cbuf
- A character buffer to write.
java.io.IOException
- Thrown if an output error occurs, or if this output stream is closed.public void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.Writer
cbuf
- A character buffer, from which a subset of characters is written.off
- The offset of the first character within character buffer cbuf
to write.len
- The number of characters from character buffer cbuf to write.
java.io.IOException
- Thrown if an output error occurs, or if this output stream is closed.public void write(java.lang.String str) throws java.io.IOException
write
in class java.io.Writer
str
- A string to write.
java.io.IOException
- Thrown if an output error occurs, or if this output stream is closed.public void write(java.lang.String str, int off, int len) throws java.io.IOException
write
in class java.io.Writer
str
- A string containing the substring to write.off
- The offset of the first character within the string to write.len
- The number of characters from the substring to write.
java.io.IOException
- Thrown if an output error occurs, or if this output stream is closed.public void write(int c) throws java.io.IOException
write
in class java.io.Writer
c
- A character code to write.
java.io.IOException
- Thrown if an output error occurs, or if this output stream is closed.public void setOutput(java.io.Writer out)
out
- The underlying output stream for this stream.public java.io.Writer getOutput()
protected void finalize() throws java.lang.Throwable
Flushes, but does not close, the underlying output stream (if there is one), and then disassociates it from this output stream.
finalize
in class java.lang.Object
java.lang.Throwable
- Thrown if an error occurs.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |