Re: Read a single byte from stdin
Arne Vajh?j wrote:
Lew wrote:
Lew wrote:
Yep. InputStream and the Reader returned by Console have
essentially
the same set of read() operations. Console does at least have
readLine() and a non-echoing readPassword().
However, InputStream does not, nor does it always have to be
buffered. Again, I trust that your tests show that System.in is
actually line buffered.
I would put it another way.
If System.in is line buffered on one or more systems, then
a portable program can not not assume it is not line buffered.
Implementation specific does not solve hos problem. He need
something that is documented to work in all compliant
implementations.
Right. In other words, if the JRE doesn't provide this (which to the
best of my knowledge, it does not), the only solution is
system-specific JNI. In fact, JRE support for this feature amounts to
a requirement that JRE implementors provide the system-specific JNI
for us.
Having said that, suppose for the sake of argument that you'd
constructed seperate JNI for Windows, Mac, and Linux [1], and were
happy that you'd now solved the problem for all of your likely users.
What's the best way to package your application? Do you need three
different versions, or is there some magic that will allow the app to
locate and load the proper version of the JNI library at runtime?
1. Linux on i86 processors, anyway.