Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #10622 > unrolled thread
| Started by | xdevel1999 <xdevel1999@gmail.com> |
|---|---|
| First post | 2011-12-09 07:31 -0800 |
| Last post | 2011-12-09 10:29 -0800 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.java.programmer
read DEL and BACK key from stdin xdevel1999 <xdevel1999@gmail.com> - 2011-12-09 07:31 -0800
Re: read DEL and BACK key from stdin Lew <lewbloch@gmail.com> - 2011-12-09 08:19 -0800
Re: read DEL and BACK key from stdin Roedy Green <see_website@mindprod.com.invalid> - 2011-12-09 10:29 -0800
| From | xdevel1999 <xdevel1999@gmail.com> |
|---|---|
| Date | 2011-12-09 07:31 -0800 |
| Subject | read DEL and BACK key from stdin |
| Message-ID | <bfaf0d1a-2933-4e82-8856-2aac14e11ce9@l29g2000yqf.googlegroups.com> |
Is it possible to read DEL and BACKSPACE keys from standard in? If I use: System.in.read() these keys are never returned. Thanks.
[toc] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2011-12-09 08:19 -0800 |
| Message-ID | <26099855.1318.1323447547152.JavaMail.geo-discussion-forums@pril5> |
| In reply to | #10622 |
xdevel1999 wrote: > Is it possible to read DEL and BACKSPACE keys from standard in? > > If I use: > > System.in.read() > > these keys are never returned. It is only possible to read what the OS puts into the input stream. What is the behavior of stdin from the OS point of view? On your platform and most that we know, the OS buffers input on that stream until it receives an end-of-line. That line is passed entire to Java to wrap as an 'InputStream' input. It follows trivially that the Java stream cannot see the characters you describe unless you escape them. Have you escaped them? "Never" is a very strong word. <http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#in> public static final InputStream in <http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html> -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2011-12-09 10:29 -0800 |
| Message-ID | <6qk4e7ta53lf0rmtc8jaif24ec5a9613mo@4ax.com> |
| In reply to | #10622 |
On Fri, 9 Dec 2011 07:31:39 -0800 (PST), xdevel1999 <xdevel1999@gmail.com> wrote, quoted or indirectly quoted someone who said : >Is it possible to read DEL and BACKSPACE keys from standard in? I don't think you see anything until the user hits enter. If you want to see things in a keystroke by keystroke way you need some sort of gui TextField or the like where you can intercept the event for each keystroke. The other way to do it is to use C. -- Roedy Green Canadian Mind Products http://mindprod.com For me, the appeal of computer programming is that even though I am quite a klutz, I can still produce something, in a sense perfect, because the computer gives me as many chances as I please to get it right.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web