public class DataSender extends Sender
Constructor and Description |
---|
DataSender(Data data,
int destWorkerID,
Workers workers,
byte command) |
DataSender(Data data,
java.lang.String host,
int port,
byte command) |
Modifier and Type | Method and Description |
---|---|
protected int |
getHeadSize(Data data)
Get the size of the head array
|
protected ByteArray |
getOPByteArray(int headArrSize)
Get the ByteArray storing the size of the
head array
|
protected void |
handleData(Connection conn,
Data data)
This method defines how to handle the data
|
protected void |
sendDataBytes(Connection conn,
ByteArray opArray,
Data data)
Send the data
|
execute, getCommand, getDestWorkerID, getWorkers
public DataSender(Data data, java.lang.String host, int port, byte command)
protected void handleData(Connection conn, Data data) throws java.lang.Exception
handleData
in class Sender
conn
- the connection objectdata
- the Datajava.lang.Exception
protected int getHeadSize(Data data)
data
- the Dataprotected ByteArray getOPByteArray(int headArrSize)
headArrSize
- the size of the head arrayprotected void sendDataBytes(Connection conn, ByteArray opArray, Data data) throws java.io.IOException
conn
- the Connection objectopArray
- the ByteArray storing the size of
the head arraydata
- the Data to be sentjava.io.IOException