Path: csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: [Windows] Any way to distinguish ^C Induced EOF from ^Z EOF? Date: Wed, 14 Mar 2012 01:21:44 +0100 Organization: albasani.net Lines: 55 Message-ID: References: <4f5f6aad$0$295$14726298@news.sunsite.dk> <4f5f7dc5$0$286$14726298@news.sunsite.dk> <4f5fde0b$0$290$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.albasani.net +8BsnEEldehizwjnZ7byhyaVLoaB021OmZG7Uq8DDo7dkoXXhHygn8raQkJlKe8cSF/MYDKX9fSt0XJNZLKJrkj73NcE6MeVaJy+cFW6w8FEoMyjoRROU32nAfv5V0o0 NNTP-Posting-Date: Wed, 14 Mar 2012 00:21:43 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="qNLsyitRR7naTczzrCtQmYMS37J9PsX3F0xOECXQclcBbL5VVFre8CZNhd0VxW0yrwBqBmJB1yhcHHgvxpaCOCZVTbJIrigmtFSdGRQkvN9UR/0sAgX/c5KZ/d0+C/x9"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Firefox/10.0.2 SeaMonkey/2.7.2 In-Reply-To: <4f5fde0b$0$290$14726298@news.sunsite.dk> Cancel-Lock: sha1:dDubk0Tt4qD26SXd+Q4XlpOgkUI= Xref: csiph.com comp.lang.java.programmer:12998 Arne Vajhøj schrieb: > If you use JNI and define a C API with certain semantics, then > it should be a relative simple task to implement that on a new > platform (assuming that there are expertise about the platform > available). In the present case JNI would be more expensive. I would need to create and bundle a .dll, a .so and a .dyln. And need 3 different platforms to develop them. (When I want to support Windows, Linux and Mac) Using sun.misc.* takes about 1 hour to implement the Ctrl-C handler. If someone comes up with a platform where there is no sun.misc.*, it might be that there is already some other Java class. "personally" using JNI to make something CPU/OS independent is most of the time last resort and NOT a good advice. There are bigger entities which have most likely already faced the problem. One has only to search. For example I found the following just now: http://rxr.whitequark.org/jruby/source/src/org/jruby/util/SunSignalFacade.java org.jruby.util.SunSignalFacade But did not dig further. But for example the good news are the IBM J9 has also sun.misc.*. BTW: It was you guys who slapped this into my face a dozen times, that I have a "personal" program- ming problem, i.e. that it is my fault. But "personal" programming problems that are CPU/OS independent should never call for JNI. Just look around whether the problem is not so "personal". But currently I don't waste some time on sun.misc.*, what interests me is: FileInputStreamFix Which fixes the superflous . This is also the title of the thread, and not where do I find a portable sun.misc.*. But the same principle does not apply, that JNI is last resort. Since it is Windows specific, thats why I put [Windows] in the thread title. Here you are right a JNI solutions is feasible. So please forget about sun.misc.* and focus on the issue. Bye