Project JXTA

net.jxta.pipe
Interface InputPipe


public interface InputPipe

InputPipe defines the interface for receiving messages from a PipeService.

An application that wants to receive messages from a Pipe will create an input pipe.

An InputPipe is created and returned by the PipeService

Since:
JXTA 1.0
See Also:
PipeService, OutputPipe, Message, MessageElement, PipeAdvertisement, GenericResolver

Method Summary
 void close()
          close the pipe
 Message poll(int timeout)
          Poll for a message from the pipe.
 Message waitForMessage()
          wait for a message to be received
 

Method Detail

waitForMessage

public Message waitForMessage()
                       throws java.lang.InterruptedException
wait for a message to be received
Returns:
Message message received
Throws:
java.lang.InterruptedException - If another thread interrupted while we were waiting for a message.
Since:
JXTA 1.0

poll

public Message poll(int timeout)
             throws java.lang.InterruptedException
Poll for a message from the pipe. If there is no message available then wait the specified amount of time. if Timeout is zero then wait indefinitely.
Parameters:
timeout - minimum time poll is supposed to block (in milliseconds)
Returns:
Message message received or null if the pipe has closed or the timeout expires without a message being delivered.
Throws:
java.lang.InterruptedException - If another thread interrupted while we were waiting for a message.
Since:
JXTA 1.0

close

public void close()
close the pipe
Since:
JXTA 1.0

Project JXTA