|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sentilla.platform.cmote.DispatcherAction
com.sentilla.platform.cmote.Sender
com.sentilla.platform.cmote.ByteSender
public class ByteSender
Field Summary |
---|
Fields inherited from class com.sentilla.platform.cmote.Sender |
---|
address, data, nextData, protocol |
Fields inherited from class com.sentilla.platform.cmote.DispatcherAction |
---|
actionState |
Constructor Summary | |
---|---|
ByteSender(int port)
|
Method Summary | |
---|---|
Action |
block()
Blocks until an interrupt is received. |
Action |
block(int timeoutMilli)
Block for "timeoutMilli" milliseconds. |
Action |
cancel()
Cancels the current action (unsupported). |
byte |
getActionState()
Returns the current action state. |
int |
getPort()
Returns the currently set port. |
long |
getTimestamp()
Returns the message timestamp. |
boolean |
isDone()
Checks if the current action state is Action.DONE . |
void |
send(byte[] buf,
int offset,
int length)
Transmits length bytes from a byte array, starting at offset. |
void |
send(ByteBuffer buf)
Transmits a ByteBuffer. |
void |
setAddress(Addressable addr)
Sets the destination address. |
ByteMessage |
setPort(int port)
Sets the port for message transmissions. |
ByteSender |
setSend(byte[] buf,
int offset,
int length)
Set the byte array containing the data to transmit. |
ByteSender |
setSend(ByteBuffer buf)
Set the ByteBuffer containing data to be transmitted. |
Action |
submit()
Submits this for processing, returns true if succeeded. |
Methods inherited from class com.sentilla.platform.cmote.Sender |
---|
send, setDone, setSend, subsubmit |
Methods inherited from class com.sentilla.platform.cmote.DispatcherAction |
---|
subcancel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteSender(int port)
Method Detail |
---|
public void send(ByteBuffer buf)
ByteSender
send
in interface ByteSender
buf
- the ByteBuffer to sendpublic void send(byte[] buf, int offset, int length)
ByteSender
length
bytes from a byte array, starting at offset.
send
in interface ByteSender
buf
- the byte array containing the data to transmitoffset
- the offset of the data in the byte arraylength
- the length in bytes of the data to transmitpublic ByteSender setSend(ByteBuffer buf)
ByteSender
setSend
in interface ByteSender
buf
- the ByteBuffer containing the data to be transmitted
this
public ByteSender setSend(byte[] buf, int offset, int length)
ByteSender
setSend
in interface ByteSender
buf
- byte array containing the data to transmitoffset
- the offset of the data in the arraylength
- the length in bytes of data to transmit
this
public int getPort()
ByteMessage
getPort
in interface ByteMessage
public long getTimestamp()
ByteMessage
getTimestamp
in interface ByteMessage
public ByteMessage setPort(int port)
ByteMessage
setPort
in interface ByteMessage
port
- the port bytes should be sent to
this
public Action block() throws ActionException
DispatcherAction
block
in interface Action
block
in class DispatcherAction
ActionException
Action
public Action block(int timeoutMilli) throws ActionException
DispatcherAction
Thread.wait(int)
, causes the action to wait
until either "timeoutMilli" milliseconds has elapsed, or an interrupt
is received.
block
in interface Action
block
in class DispatcherAction
timeoutMilli
- number of milliseconds to block
ActionException
Action
public Action cancel()
DispatcherAction
Action
interface.
cancel
in interface Action
cancel
in class DispatcherAction
Action
public byte getActionState()
DispatcherAction
getActionState
in interface Action
getActionState
in class DispatcherAction
Action
public boolean isDone() throws ActionException
DispatcherAction
Action.DONE
.
Returns true if the action is done.
isDone
in interface Action
isDone
in class DispatcherAction
ActionException
Action
public Action submit()
DispatcherAction
this
for processing, returns true if succeeded.
Used by the Sender and Receiver
to implement the system Action
interface. Classes deriving from
DispatcherAction must implement the subsubmit()
method.
submit
in interface Action
submit
in class DispatcherAction
Action
public void setAddress(Addressable addr)
Sender
setAddress
in interface Sender
setAddress
in class Sender
addr
- object implementing Addressable interface to be used as addressAddressable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |