DRCL J-Sim API

drcl.comp.lib.bytestream
Class ByteStreamContract

java.lang.Object
  extended bydrcl.comp.Contract
      extended bydrcl.comp.lib.bytestream.ByteStreamContract
All Implemented Interfaces:
ByteStreamConstants

public class ByteStreamContract
extends Contract
implements ByteStreamConstants

The byte stream sending contract. In this contract, the initiator sends byte stream data to the reactor. The reactor has a receiving buffer to hold the data and the data is consumed by the reactor at the pace depending on the implementation of the reactor.

ByteStreamSending
The initiator sends a message which consists of:
  1. an integer of 0 (the "send" command),
  2. the byte array (byte[]),
  3. the offset of the first byte in the byte array to start sending, and
  4. the length of sending (int).
The reactor moves the bytes of the specified length (> 0) from the byte array to its buffer if the buffer in the reactor allows, and may return an Integer indicating the available receiving buffer in bytes in the reactor. A negative value indicates the amount of buffer overflow if the data is too large to fit in the receiving buffer.
BufferReport
The reactor sends the available receiving buffer size in bytes in a message whenever data is consumed and removed from the buffer. The message consists of:
  1. an integer of 1 (the "report" command) and
  2. the available buffer size in bytes (int).
BufferQuery
The initiator sends a message which consists of an integer of 2 (the "query" command). In response, the reactor returns the available buffer in bytes in Integer.

Version:
1.0, 06/2001
Author:
Hung-ying Tyan

Nested Class Summary
static class ByteStreamContract.Message
           
 
Field Summary
 
Fields inherited from class drcl.comp.Contract
Role_INITIATOR, Role_PEER, Role_REACTOR
 
Fields inherited from interface drcl.comp.lib.bytestream.ByteStreamConstants
ERROR, QUERY, REPORT, SEND
 
Constructor Summary
ByteStreamContract()
           
ByteStreamContract(int role_)
           
 
Method Summary
 java.lang.Object getContractContent()
          Returns the content of this contract (format?).
 java.lang.String getName()
           
static int query(Port port_)
           
 
Methods inherited from class drcl.comp.Contract
getRole, match, setRole
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteStreamContract

public ByteStreamContract()

ByteStreamContract

public ByteStreamContract(int role_)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class Contract

getContractContent

public java.lang.Object getContractContent()
Description copied from class: Contract
Returns the content of this contract (format?).

Specified by:
getContractContent in class Contract

query

public static int query(Port port_)

DRCL J-Sim API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~