public class DocumentWriter
extends java.io.Writer
Constructor and Description |
---|
DocumentWriter(javax.swing.text.Document doc)
Constructs an output stream that will output to the
given document with whatever the default attributes
are.
|
DocumentWriter(javax.swing.text.Document doc,
javax.swing.text.AttributeSet a)
Constructs an output stream that will output to the
given document with the given set of character attributes.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream, flushing it first.
|
void |
flush()
Flush the stream.
|
void |
write(char[] cbuf,
int off,
int len)
Write a portion of an array of characters.
|
void |
write(java.lang.String str)
Write a string.
|
void |
write(java.lang.String str,
int off,
int len)
Write a portion of a string.
|
public DocumentWriter(javax.swing.text.Document doc, javax.swing.text.AttributeSet a)
doc
- the document to write to.a
- the character attributes to use for the written
text.public DocumentWriter(javax.swing.text.Document doc)
doc
- the document to write to.public void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.Writer
cbuf
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to writejava.io.IOException
- If an I/O error occurspublic void write(java.lang.String str, int off, int len) throws java.io.IOException
write
in class java.io.Writer
str
- A Stringoff
- Offset from which to start writing characterslen
- Number of characters to writejava.io.IOException
- If an I/O error occurspublic void write(java.lang.String str) throws java.io.IOException
write
in class java.io.Writer
str
- String to be writtenjava.io.IOException
- If an I/O error occurspublic void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
- If an I/O error occurspublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
- If an I/O error occurs