mirror of
https://gitee.com/BDWare/cm
synced 2025-04-28 15:02:16 +00:00
47 lines
1.1 KiB
Java
47 lines
1.1 KiB
Java
package org.bdware.sc.units;
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
import java.io.Serializable;
|
|
|
|
import org.bdware.sc.bean.Contract;
|
|
import org.bdware.sc.conn.Node;
|
|
|
|
public class ContractUnitStartRequest implements Serializable {
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = -1540780483790689627L;
|
|
public Contract contract;
|
|
public boolean isMaster;
|
|
public Node[] members;
|
|
|
|
public static ContractUnitStartRequest parse(byte[] content) {
|
|
try {
|
|
ByteArrayInputStream input = new ByteArrayInputStream(content);
|
|
ObjectInputStream objInput;
|
|
objInput = new ObjectInputStream(input);
|
|
return (ContractUnitStartRequest) objInput.readObject();
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public byte[] toByteArray() {
|
|
try {
|
|
ByteArrayOutputStream bo = new ByteArrayOutputStream();
|
|
ObjectOutputStream objOutput = new ObjectOutputStream(bo);
|
|
objOutput.writeObject(this);
|
|
return bo.toByteArray();
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
}
|