From owner-freebsd-java@FreeBSD.ORG Mon Nov 17 08:28:25 2003 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 60DCD16A4CE for ; Mon, 17 Nov 2003 08:28:25 -0800 (PST) Received: from arwen.dawnbreaks.net (eth4771.sa.adsl.internode.on.net [150.101.250.162]) by mx1.FreeBSD.org (Postfix) with SMTP id 173B543FCB for ; Mon, 17 Nov 2003 08:28:23 -0800 (PST) (envelope-from db@dawnbreaks.net) Received: (qmail 24665 invoked by uid 1001); 17 Nov 2003 16:28:35 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 17 Nov 2003 16:28:35 -0000 Date: Tue, 18 Nov 2003 02:58:35 +1030 (CST) From: David Bullock X-X-Sender: db@arwen.lorien.dawnbreaks.net To: freebsd-java@freebsd.org Message-ID: <20031118022533.D72868-100000@arwen.lorien.dawnbreaks.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: using UNIX pipes from Java X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2003 16:28:25 -0000 Hi folks, I have a need to read a stream of data from some Perl process into my Java program, but I can't guarantee that the JVM will be started at the same time as the Perl process, so the obvious solution of using System.in doesn't seem applicable. Using TCP sockets seems rather expensive, as the process will be local. So ... not knowing much about UNIX pipes beyond having seen some odd things in the filesystem, I speculate: 1. sysadmin does does 'mkfifo /path/to/fifo' 2. Perl script opens the fifo write-only using black Perl magic 3. from Java I do: InputStream in = new FileInputStream("/path/to/fifo"); Am I on a good track? Or are there better approaches? I looked at java.nio, but the Pipe class doesn't take any arguments. (I realise this post is not strictly to do with the FreeBSD Java port, so feel free to ignore me, but this list seemed like a good place to place to ask for, uh, pointers) many thanks, David