How do I use unix pipes with java?
1 posts in topic
Flat View  Flat View

Posted By:   Dante_Buhay
Posted On:   Monday, July 16, 2001 07:12 AM

Im wanting to write an java application that will store input pipe data from Exim (a mail service) into a MySql db.

I would like to know how I open the pipe for input from my java code.


Re: How do I use unix pipes with java?

Posted By:   Nathan_Meyers  
Posted On:   Monday, July 16, 2001 06:25 PM

Java doesn't give you direct access to non-portable capabilities like Unix/Linux pipes. You can still do quite a few things with pipes, for example:

  • Create a named pipe by invoking the mkfifo utility in a Runtime.exec() method.

  • Open a named pipe by name - which is just like opening a file.

  • Run an external process with Runtime.exec() and access its input and output streams via the Process.getInputStream() and Process.getOutputStream() methods.

Maybe these are enough to solve your problem? If not - that is, if you need to get to the pipe() system call - you'll need to write your own JNI code to do it.

About | Sitemap | Contact