Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #12918

Re: Making System.in interruptible, how?

Date 2012-03-12 16:18 -0400
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: Making System.in interruptible, how?
References <ji0937$tcb$1@news.albasani.net> <jjdk1d$unj$1@news.albasani.net> <4f5abac6$0$290$14726298@news.sunsite.dk> <jjg6jo$vd3$1@news.albasani.net>
Message-ID <4f5e5a20$0$282$14726298@news.sunsite.dk> (permalink)
Organization SunSITE.dk - Supporting Open source

Show all headers | View raw


On 3/10/2012 1:30 PM, Jan Burse wrote:
> Arne Vajhøj schrieb:
>>> I have finally adopted the ready() solution. I guess that
>>> if the input stream is redirected to a file, the ready()
>>> will mostly return true, so that performance is no issue.
>>
>> File is not the problem.
>>
>> The problem is that it dos not seem to be guaranteed to
>> work.

> Yep, doesn't work on Windows 7 / JDK 1.7. Somehow
> inside cmd.exe the ready does not echo. So I enter
> a line, done see anything during editing the line,
> and then when I hit return the line gets read.
>
> On Mac OS / JDK 1.7 in the standard terminal
> and in xterm it works fine. During a ready call,
> everything I type is echoed, a line can fully be
> edited, and then when hitting return the line
> gets read.

My advice is still: either do it true cross platform
in pure Java and stay away from anything that is not
clearly documented to work, or use JNI to call some
platform specific C code that does exactly what you want.

In the first case, then it just works everywhere. The
cost is that the UI may be a bit "dumb".

In the second case it is very well defined what has to
be done to get the code working on a new platform.

Using not well defined behavior will eventually create
very painfully experiences when it stop working due
to: new platform, OS upgrade, Java upgrade etc..

Arne

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Making System.in interruptible, how? Jan Burse <janburse@fastmail.fm> - 2012-03-09 20:01 +0100
  Re: Making System.in interruptible, how? Arne Vajhøj <arne@vajhoej.dk> - 2012-03-09 21:21 -0500
    Re: Making System.in interruptible, how? Jan Burse <janburse@fastmail.fm> - 2012-03-10 19:30 +0100
      Re: Making System.in interruptible, how? Arne Vajhøj <arne@vajhoej.dk> - 2012-03-12 16:18 -0400
    Re: Making System.in interruptible, how? Jan Burse <janburse@fastmail.fm> - 2012-03-10 20:30 +0100

csiph-web