satc.swing
Class SwingDocumentStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--satc.DocumentStream
              |
              +--satc.swing.SwingDocumentStream

public class SwingDocumentStream
extends DocumentStream

Class to provide InputStream functionality from a portion of a Document.


Field Summary
 int index
           
 int p0
           
 int p1
           
 int pos
           
 javax.swing.text.Segment segment
           
 
Constructor Summary
SwingDocumentStream()
           
SwingDocumentStream(javax.swing.text.Document doc)
           
 
Method Summary
 int read()
          Reads the next byte of data from this input stream.
 void reset()
          Reset the document stream.
 void setDocument(java.lang.Object doc)
           
 void setRange(int p0, int p1)
          Restrict the stream to a range of the document.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

segment

public javax.swing.text.Segment segment

p0

public int p0

p1

public int p1

pos

public int pos

index

public int index
Constructor Detail

SwingDocumentStream

public SwingDocumentStream(javax.swing.text.Document doc)

SwingDocumentStream

public SwingDocumentStream()
Method Detail

setDocument

public void setDocument(java.lang.Object doc)
Overrides:
setDocument in class DocumentStream

reset

public void reset()
Reset the document stream. The stream is positioned at the begining of the document and the range of the stream is set to cover the whole document.
Overrides:
reset in class DocumentStream

setRange

public void setRange(int p0,
                     int p1)
Restrict the stream to a range of the document.
Overrides:
setRange in class DocumentStream

read

public int read()
         throws java.io.IOException
Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

A subclass must provide an implementation of this method.

Overrides:
read in class DocumentStream
Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
java.io.IOException - if an I/O error occurs.