|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
jay.yydebug.yyJInputStream
public class yyJInputStream
used to reroute standard input from a JTextArea.
Feeds all read methods from listening to typed keys.
Should not deadlock because one should generally not
read from within the event thread.
While this implementation avoids Java generics, code for a generic version has simply been commented out.
| Field Summary | |
|---|---|
protected StringBuffer |
line
line edit buffer. |
protected ArrayList |
queue
completed lines, ready to be read. |
| Constructor Summary | |
|---|---|
yyJInputStream()
|
|
| Method Summary | |
|---|---|
int |
available()
|
void |
close()
|
protected void |
doKey(JTextArea ta,
char ch,
boolean paste)
process one typed or pasted character. |
void |
keyPressed(KeyEvent ke)
this one ensures that you can only type at the end and implements control-C as copy and control-V as paste key if AWTPermission(accessClipboard) is granted. |
void |
keyReleased(KeyEvent ke)
|
void |
keyTyped(KeyEvent ke)
|
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
long |
skip(long len)
returns 0: cannot skip on a terminal. |
| Methods inherited from class java.io.InputStream |
|---|
mark, markSupported, read, reset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final StringBuffer line
protected ArrayList queue
close().
| Constructor Detail |
|---|
public yyJInputStream()
| Method Detail |
|---|
public int available()
throws IOException
available in class InputStreamIOException
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOException
public int read()
throws IOException
read in class InputStreamIOException
public int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic long skip(long len)
skip in class InputStreampublic void keyPressed(KeyEvent ke)
BUG: paste should be based on the platform paste key; however, Safari does not send that one to an applet.
keyPressed in interface KeyListenerpublic void keyTyped(KeyEvent ke)
keyTyped in interface KeyListener
protected void doKey(JTextArea ta,
char ch,
boolean paste)
public void keyReleased(KeyEvent ke)
keyReleased in interface KeyListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||