read unbuffered from STDIN

Matthias Apitz guru at unixarea.de
Tue Mar 3 11:48:58 UTC 2015


El día Tuesday, March 03, 2015 a las 11:07:04AM +0100, Ronald Klop escribió:

> On Fri, 27 Feb 2015 16:00:46 +0100, Matthias Apitz <guru at unixarea.de>  
> wrote:
> 
> > El día Friday, February 27, 2015 a las 03:20:14PM +0100, Matthias Apitz  
> > escribió:
> >
> >> This does not work in FreeBSD+eclipse and as well not when started as
> >>
> >> $ javac reader.java
> >> $ java -cp . reader
> >
> > It does work when one does:
> >
> > $ stty raw ; java -cp . reader
> > Enter characters, 'q' to quit.
> >                               a
> >                                a
> >                                 a
> >
> > Any ideas how to issue the 'stty raw' from within the java classes?
> >
> > 	matthias
> >
> 
> I have never used them, but java.io.Console and java.util.Scanner might  
> solve your issue.
> http://docs.oracle.com/javase/7/docs/api/index.html?java/util/Scanner.html
> http://docs.oracle.com/javase/7/docs/api/index.html?java/io/Console.html

Thanks for the pointers; I have checked both and did some coding -- no
luck; and there is no indication in both that one can switch the console
into a RAW mode, as I showed with the above ioctl(2) call on cmd line.

I'm a bit wondering, that this is so uncommon, due to the fact that
device programmers (modems, all kind of serial line interfaces) for sure
need the same thing.

	matthias

-- 
Matthias Apitz, guru at unixarea.de, http://www.unixarea.de/ +49-170-4527211
La referencia de la Duma a la anexión de la RDA, en este caso al contrario con la Crimlía sin
referéndum, no solamente tiene gracia sino da en el blanco.- 
Marinos Yannikos @MarinosYannikos en un blog de RTdeutsch.


More information about the freebsd-java mailing list