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

Method Summary
 void close()
          Close the pipe.
 PipeAdvertisement getAdvertisement()
          Gets the pipe advertisement
 String getName()
          Gets the pipe name
 ID getPipeID()
          Gets the pipe id
 String getType()
          Gets the pipe type
 Message poll(int timeout)
          Poll for a message from the pipe.
 Message waitForMessage()
          Wait (block) for a message to be received.
 

Method Detail

waitForMessage

Message waitForMessage()
                       throws InterruptedException
Wait (block) for a message to be received.

Returns:
a message or null if the pipe has been closed.
Throws:
InterruptedException - If another thread interrupted while we were waiting for a message.

poll

Message poll(int timeout)
             throws InterruptedException
Poll for a message from the pipe. If there is no message immediately available then wait the specified amount of time for a message to arrive.

Parameters:
timeout - Maximum number of milliseconds to wait (block) for a message to be received. If zero then wait indefinitely for a message.
Returns:
Message received or null if the pipe has closed or the timeout expired without a message being received.
Throws:
InterruptedException - If another thread interrupted while we were waiting for a message.

close

void close()
Close the pipe. No additional messages will be received on this pipe.


getType

String getType()
Gets the pipe type

Returns:
The type

getPipeID

ID getPipeID()
Gets the pipe id

Returns:
The type

getName

String getName()
Gets the pipe name

Returns:
The name

getAdvertisement

PipeAdvertisement getAdvertisement()
Gets the pipe advertisement

Returns:
The advertisement

JXTA J2SE