public class yyInputStream extends InputStream implements KeyListener
TextArea
.
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.
Modifier and Type | Field and Description |
---|---|
protected StringBuffer |
line
line edit buffer.
|
protected ArrayList |
queue
completed lines, ready to be read.
|
Constructor and Description |
---|
yyInputStream() |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
void |
keyPressed(KeyEvent ke)
this one ensures that you can only type at the end.
|
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.
|
mark, markSupported, read, reset
protected final StringBuffer line
public int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public long skip(long len)
skip
in class InputStream
public void keyPressed(KeyEvent ke)
keyPressed
in interface KeyListener
public void keyTyped(KeyEvent ke)
keyTyped
in interface KeyListener
public void keyReleased(KeyEvent ke)
keyReleased
in interface KeyListener
Copyright © 2018. All rights reserved.