mae.util
Class DialogInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byjava.io.BufferedInputStream
              extended bymae.util.DialogInputStream

public class DialogInputStream
extends java.io.BufferedInputStream

Redirects system input to a JDialog.

 Usage:
 DialogInputStream in = DialogInputStream.redirect(frame);
 ...  //in.setMessage(msg);
 ...  //System.in.read();
 in.close();
 
Cancel key signals end of file.


Field Summary
 
Fields inherited from class java.io.BufferedInputStream
buf, count, marklimit, markpos, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Method Summary
 int available()
          Returns remaining number of bytes in the buffer
 void close()
          Closes this InputStream and resets system input
 boolean isClosed()
          Indicates if this InputStream is closed
 boolean markSupported()
          Returns false
 int read()
          Reads and returns one byte
 int read(byte[] b, int off, int n)
          Reads at most n bytes into b[off]
static DialogInputStream redirect()
          Returns a new instance
static DialogInputStream redirect(java.awt.Component c)
          Returns a new instance, using c as the parent for JDialog
 void setMessage(java.lang.String s)
          Sets message to be used in subsequent read operations.
 
Methods inherited from class java.io.BufferedInputStream
mark, reset, skip
 
Methods inherited from class java.io.FilterInputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

redirect

public static DialogInputStream redirect()
Returns a new instance


redirect

public static DialogInputStream redirect(java.awt.Component c)
Returns a new instance, using c as the parent for JDialog


read

public int read()
Reads and returns one byte


read

public int read(byte[] b,
                int off,
                int n)
Reads at most n bytes into b[off]


available

public int available()
Returns remaining number of bytes in the buffer


close

public void close()
Closes this InputStream and resets system input


isClosed

public boolean isClosed()
Indicates if this InputStream is closed


markSupported

public boolean markSupported()
Returns false


setMessage

public void setMessage(java.lang.String s)
Sets message to be used in subsequent read operations.
Default is "Input String is requested"