org.freehep.util
Class DocumentOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.freehep.util.DocumentOutputStream
-
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
public class DocumentOutputStream extends java.io.OutputStreamAn OutputStream implementation that places it's output in a swing text model (Document). The Document can be either a plain text or styled document implementation. If styled, the attributes assigned to the output stream will be used in the display of the output.
-
-
Constructor Summary
Constructors Constructor and Description DocumentOutputStream(javax.swing.text.Document doc)Constructs an output stream that will output to the given document with whatever the default attributes are.DocumentOutputStream(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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidwrite(byte[] b, int off, int len)Writeslenbytes from the specified byte array starting at offsetoffto this output stream.voidwrite(int b)Writes the specified byte to this output stream.
-
-
-
Constructor Detail
-
DocumentOutputStream
public DocumentOutputStream(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.- Parameters:
doc- the document to write to.a- the character attributes to use for the written text.
-
DocumentOutputStream
public DocumentOutputStream(javax.swing.text.Document doc)
Constructs an output stream that will output to the given document with whatever the default attributes are.- Parameters:
doc- the document to write to.
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOExceptionWrites the specified byte to this output stream.Subclasses of
OutputStreammust provide an implementation for this method.- Specified by:
writein classjava.io.OutputStream- Parameters:
b- thebyte.- Throws:
java.io.IOException- if an I/O error occurs.- Since:
- JDK1.0
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionWriteslenbytes from the specified byte array starting at offsetoffto this output stream.The
writemethod ofOutputStreamcalls the write method of one argument on each of the bytes to be written out. Subclasses are encouraged to override this method and provide a more efficient implementation.- Overrides:
writein classjava.io.OutputStream- Parameters:
b- the data.off- the start offset in the data.len- the number of bytes to write.- Throws:
java.io.IOException- if an I/O error occurs.- Since:
- JDK1.0
-
-
DMelt 3.0 © DataMelt by jWork.ORG