Reading Named Pipes in Unix from Java

How do I write a Java program that reads from a FIFO xferlog generated

by the FTP server running on Unix. The java program should continuously

read from the xferlog. How do I read the fifo xferlog on Unix from Java

? Is it the same as reading from a normal file input stream or Do I

need to use Piped input stream ? An approach to this problem would be

of great help.

[416 byte] By [ Taarini] at [2007-9-30 9:22:10]
# 1

I've never done this in Java, but in every other UNIX language, reading a FIFO pipe is just like reading a normal file.

Basically, if there is no data in the FIFO, the program will wait until there is data, then read it.

When the write end of the FIFO pipe is closed, then the read end receives an EOF indication and should terminate (or do whatever is appropriate).

John_McKown at 2007-7-2 23:35:38 > top of Java-index,Administration Tools,Sun Connection...
# 2

> When the write end of the FIFO pipe is closed

Named pipes can be opened through several file desciptors. When *all* open file desriptors referring to a pipe are closed, only then is EOF indicated at the reading side. Named pipes "dwell" in the file system, and can be accessed as files through their names in the file system.

BIJ at 2007-7-2 23:35:38 > top of Java-index,Administration Tools,Sun Connection...