edu.rice.cs.util.swing
Class DocumentOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by edu.rice.cs.util.swing.DocumentOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class DocumentOutputStream
extends OutputStream

An extension of OutputStream that writes its output to an implementation of Document.

Version:
$Id: DocumentOutputStream.java 4519 2008-06-15 07:14:29Z rcartwright $

Constructor Summary
DocumentOutputStream(Document doc)
          Constructs an OutputStream that writes its output to a Document.
DocumentOutputStream(Document doc, AttributeSet attributes)
          Constructs an OutputStream that writes its output to a Document.
 
Method Summary
 void write(byte[] b, int off, int len)
          Writes an array of characters (bytes) to the stream at a particular offset.
 void write(int c)
          Writes a character to the stream.
 
Methods inherited from class java.io.OutputStream
close, flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentOutputStream

public DocumentOutputStream(Document doc)
Constructs an OutputStream that writes its output to a Document. When this constructor is used, all insertions to the Document will be done with the attributes set to null.

Parameters:
doc - Document to write output to.

DocumentOutputStream

public DocumentOutputStream(Document doc,
                            AttributeSet attributes)
Constructs an OutputStream that writes its output to a Document.

Parameters:
doc - Document to write output to.
attributes - Attributes to use for inserting text into the document that is sent to this stream.
Method Detail

write

public void write(int c)
Writes a character to the stream.

Specified by:
write in class OutputStream
Parameters:
c - the ASCII value of the character to write.

write

public void write(byte[] b,
                  int off,
                  int len)
Writes an array of characters (bytes) to the stream at a particular offset.

Overrides:
write in class OutputStream
Parameters:
b - characters to write to stream
off - start of writing
len - number of characters to write from b