Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, tutorials, and more.

Pipes

One of
the most powerful of JXTA’s services is the pipe
service. The idea of a pipe is familiar to users of Unix systems: a
pipe is used to connect the output from one command to the input of
another command. On a Unix system, if you want to count the number of
unique exceptions that occur in a log file, you might use this
command:

piccolo% cat log | grep "Exception" | sort | uniq | wc -l

The cat command
prints the log file to its standard output. The
grep command reads this file from its standard
input and searches for lines containing the string
“Exception”; it prints matching
lines to its standard output. The sort command
reads these lines from its standard input and sends the sorted list
to its standard output, where it is read by the
uniq command, which removes duplicate lines. The
unduplicated lines are sent to its standard output, where they are
read by the wc command, which counts the number of
lines and finally prints that number.

Pipes are quite useful in that they allow you to build complex
functionality from a number of simple building blocks. JXTA takes the
familiar idea of pipes and extends their functionality to the
network.

Peer Endpoints

JXTA
pipes are defined in terms of the endpoints available to a peer. A peer endpoint is a logical abstraction of an address on a network transport that is capable of sending and receiving network messages. In the examples we’ve seen so far, the network transport has always been IP-based: the shell peer we’ve looked ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.