Package jay.yydebug
Class yyInputStream
- java.lang.Object
-
- java.io.InputStream
-
- jay.yydebug.yyInputStream
-
- All Implemented Interfaces:
java.awt.event.KeyListener,java.io.Closeable,java.lang.AutoCloseable,java.util.EventListener
public class yyInputStream extends java.io.InputStream implements java.awt.event.KeyListenerused to reroute standard input from aTextArea. 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 uses Java generics, code for a non-generic version has simply been commented out.
-
-
Constructor Summary
Constructors Constructor Description yyInputStream()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()voidkeyPressed(java.awt.event.KeyEvent ke)this one ensures that you can only type at the end.voidkeyReleased(java.awt.event.KeyEvent ke)voidkeyTyped(java.awt.event.KeyEvent ke)intread()intread(byte[] b, int off, int len)longskip(long len)returns 0: cannot skip on a terminal.
-
-
-
Field Detail
-
line
protected final java.lang.StringBuffer line
line edit buffer.
-
queue
protected java.util.ArrayList queue
completed lines, ready to be read. Invariant: null afterclose().
-
-
Method Detail
-
available
public int available() throws java.io.IOException- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
skip
public long skip(long len)
returns 0: cannot skip on a terminal.- Overrides:
skipin classjava.io.InputStream
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent ke)
this one ensures that you can only type at the end. This is executed within the event thread.- Specified by:
keyPressedin interfacejava.awt.event.KeyListener
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent ke)
- Specified by:
keyTypedin interfacejava.awt.event.KeyListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent ke)
- Specified by:
keyReleasedin interfacejava.awt.event.KeyListener
-
-