|
DRCL J-Sim API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectdrcl.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| Field Summary |
| 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()
|
void |
interruptReceiving()
Interrupts a blocked receiving with the default IO exception. |
void |
interruptReceiving(java.io.IOException e)
Interrupts a blocked receiving with the given exception. |
void |
interruptSending()
Interrupts a blocked sending with the default IO exception. |
void |
interruptSending(java.io.IOException e)
Interrupts a blocked sending with the specified IO exception. |
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_)
|
java.lang.String |
toString()
|
| Methods inherited from class drcl.DrclObj |
clone, duplicate |
| Methods inherited from class java.lang.Object |
equals, 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.
java.io.IOExceptionByteStreamContract
public void send(byte[] buffer_)
throws java.io.IOException
buffer_ thru the down port.
buffer_ - where is put the data to be sent.
java.io.IOExceptionByteStreamContract
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.
java.io.IOExceptionByteStreamContract
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.
java.io.IOExceptionByteStreamContractpublic void handle(ByteStreamContract.Message msg_)
public int receive()
throws java.io.IOException
java.io.IOExceptionByteStreamContract
public int receive(int size_)
throws java.io.IOException
size_ bytes of data from the lower layer protocol.
No real data is received.
java.io.IOExceptionByteStreamContract
public int receive(byte[] buffer_)
throws java.io.IOException
buffer_ - the buffer to store the incoming data.
java.io.IOExceptionByteStreamContract
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.
java.io.IOExceptionByteStreamContract
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.
java.io.IOExceptionByteStreamContractpublic void interruptSending()
send(byte[], int, int)public void interruptSending(java.io.IOException e)
send(byte[], int, int)public void interruptReceiving()
receive(byte[], int, int)public void interruptReceiving(java.io.IOException e)
receive(byte[], int, int)public java.lang.String toString()
toString in class DrclObj
|
DRCL J-Sim API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||