Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Nov 2003 02:58:35 +1030 (CST)
From:      David Bullock <db@dawnbreaks.net>
To:        freebsd-java@freebsd.org
Subject:   using UNIX pipes from Java
Message-ID:  <20031118022533.D72868-100000@arwen.lorien.dawnbreaks.net>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031118022533.D72868-100000>