|
DRCL JavaSim API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--drcl.DrclObj
|
+--drcl.comp.lib.bytestream.ByteStreamPeer
ByteStreamPeer is a helper class to conduct the ByteStreamContract both
as an initiator and a reactor.
This class provides blocked send() and receive() methods to send/receive
byte streams to/from the peer.
ByteStreamContract, Serialized Form| Fields inherited from interface drcl.comp.lib.bytestream.ByteStreamConstants |
ERROR, QUERY, REPORT, SEND |
| Constructor Summary | |
ByteStreamPeer()
|
|
ByteStreamPeer(Port down_)
|
|
| Method Summary | |
java.io.InputStream |
getInputStream()
|
java.io.OutputStream |
getOutputStream()
|
int |
getReceiveBufferSize()
|
void |
handle(ByteStreamContract.Message msg_)
Handles a message from the peer. |
void |
hookup(Port down_)
|
java.lang.String |
info()
|
int |
receive()
Receives whatever is currently buffered from the lower layer protocol. |
int |
receive(byte[] buffer_)
Receives a buffer of data from the lower layer protocol. |
int |
receive(byte[] buffer_,
int size_)
Receives a maximun of size_ data from the lower layer protocol. |
int |
receive(byte[] buffer_,
int offset_,
int size_)
Receives a maximun of size_ data from the lower layer protocol. |
int |
receive(int size_)
Receives size_ bytes of data from the lower layer protocol. |
void |
reset()
|
void |
send(byte[] buffer_)
Sends a buffer of data from buffer_ thru the down port. |
void |
send(byte[] buffer_,
int len_)
Sends len_ bytes of data from buffer_ thru the down port. |
void |
send(byte[] buffer_,
int offset_,
int len_)
Sends len_ bytes of data from buffer_ thru the down port. |
void |
send(int len_)
Sends len_ bytes of data thru the down port. |
void |
setReceiveBufferSize(int size_)
|
| Methods inherited from class drcl.DrclObj |
clone, duplicate, toString |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ByteStreamPeer()
public ByteStreamPeer(Port down_)
| Method Detail |
public void reset()
public void hookup(Port down_)
public java.io.InputStream getInputStream()
public java.io.OutputStream getOutputStream()
public java.lang.String info()
public void setReceiveBufferSize(int size_)
public int getReceiveBufferSize()
public void send(int len_)
throws java.io.IOException
len_ bytes of data thru the down port.
The lower layer protocol is supposed to contruct and send pseudo-packets
with no real data in it.len_ - number of bytes to send.ByteStreamContract
public void send(byte[] buffer_)
throws java.io.IOException
buffer_ thru the down port.buffer_ - where is put the data to be sent.ByteStreamContract
public void send(byte[] buffer_,
int len_)
throws java.io.IOException
len_ bytes of data from buffer_ thru the down port.
The lower layer (transport) is supposed to contruct and send pseudo-packets
with no real data in it if buffer_ is null.buffer_ - where is put the data to be sent.len_ - number of bytes to send.ByteStreamContract
public void send(byte[] buffer_,
int offset_,
int len_)
throws java.io.IOException
len_ bytes of data from buffer_ thru the down port.
The lower layer (transport) is supposed to contruct and send pseudo-packets
with no real data in it if buffer_ is null.buffer_ - where is put the data to be sent.offset_ - offset to the buffer where to start sending data.len_ - number of bytes to send.ByteStreamContractpublic void handle(ByteStreamContract.Message msg_)
public int receive()
throws java.io.IOException
ByteStreamContract
public int receive(int size_)
throws java.io.IOException
size_ bytes of data from the lower layer protocol.
No real data is received.size - of data expected to receive.ByteStreamContract
public int receive(byte[] buffer_)
throws java.io.IOException
buffer_ - the buffer to store the incoming data.ByteStreamContract
public int receive(byte[] buffer_,
int size_)
throws java.io.IOException
size_ data from the lower layer protocol.
No real data is received if buffer_ is null.
If size_ is greater than 0, this method will be blocked until exactly
the size of data is filled to the buffer.
If size_ is less than 0, then the method will grab all the data
available right now till the buffer is full.buffer_ - the buffer to store the incoming data.size - of data expected to receive.ByteStreamContract
public int receive(byte[] buffer_,
int offset_,
int size_)
throws java.io.IOException
size_ data from the lower layer protocol.
No real data is received if buffer_ is null.
If size_ is greater than 0, this method will be blocked until exactly
the size of data is filled to the buffer.
If size_ is less than 0, then the method will grab all the data
available right now till the buffer is full.buffer_ - the buffer to store the incoming data.offset_ - offset in the buffer to start storing the incoming data.size_ - size of data expected to receive.ByteStreamContract
|
DRCL JavaSim API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||