All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface jcsp.lang.ChannelOutput

public interface ChannelOutput

Description

ChannelOutput defines the interface for writing to the Java version of occam Channels. The interface contains only one method write(Object object), which writes to the Channel. Upon invoking the write() method the Object will be stored in the Channel, if the Channel is not full the method will return immediately, otherwise the method will block until data has been read from the Channel, the method will then return.

The ChannelOutput interface should be used to hold references to Channels when they are only going to be used for writing data to. By using the ChannelOutput interface any attempt to read from the Channel using the reference to a ChannelOutput type will generate a compile time error. The following code fragment would not compile.

   Object doRead(ChannelOutput c) {
   return c.read(); // illegal
 
This interface should be used to pass Channels around where processes only require read access to the Channel.

Instances of any Class may be written to a Channel.

Example

 void doWrite(ChannelOutput c, Object o) {
   c.write(o);
 }
 

Author:
P.D.Austin

Method Index

 o write(Object)
Writes an Object to the Channel.

Methods

 o write
 public abstract void write(Object object)
Writes an Object to the Channel.

Parameters:
object - The object to write to the Channel.

All Packages  Class Hierarchy  This Package  Previous  Next  Index