jhomenet.server.console.io
Class ConsoleInputStream
java.lang.Object
java.io.InputStream
jhomenet.server.console.io.ConsoleInputStream
- All Implemented Interfaces:
- java.awt.event.KeyListener, java.io.Closeable, java.util.EventListener
public class ConsoleInputStream
- extends java.io.InputStream
- implements java.awt.event.KeyListener
An input stream that can be used for reading from a console. In particular, this
class listens for key strokes on a passed JTextArea
and converts the
keystrokes into integer values suitable for use in an InputStream
.
Id: $Id: $
- Author:
- Dave Irwin (david.irwin@jhu.edu)
- See Also:
InputStream
,
KeyListener
Constructor Summary |
ConsoleInputStream(javax.swing.JTextArea textArea)
Default constructor. |
Methods inherited from class java.io.InputStream |
close, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConsoleInputStream
public ConsoleInputStream(javax.swing.JTextArea textArea)
- Default constructor.
- Parameters:
textArea
-
read
public int read()
throws java.io.IOException
- Specified by:
read
in class java.io.InputStream
- Throws:
java.io.IOException
- See Also:
InputStream.read()
available
public int available()
- Overrides:
available
in class java.io.InputStream
- See Also:
InputStream.available()
keyPressed
public void keyPressed(java.awt.event.KeyEvent event)
- Specified by:
keyPressed
in interface java.awt.event.KeyListener
- See Also:
KeyListener.keyPressed(java.awt.event.KeyEvent)
keyReleased
public void keyReleased(java.awt.event.KeyEvent event)
- Specified by:
keyReleased
in interface java.awt.event.KeyListener
- See Also:
KeyListener.keyReleased(java.awt.event.KeyEvent)
keyTyped
public void keyTyped(java.awt.event.KeyEvent event)
- Specified by:
keyTyped
in interface java.awt.event.KeyListener
- See Also:
KeyListener.keyTyped(java.awt.event.KeyEvent)
Copyright © 2004-2007 David Irwin. All Rights Reserved.