📄 task.java
字号:
package com.ict.netcom2.task;
import java.io.*;
public class Task implements Serializable {
private int taskId;
private long delay;
private boolean isRoutine;
private TaskParam param;
private int taskType;
private byte[] taskCode;
private String oid;
public Task (int taskId, long delay, boolean isRoutine,
TaskParam param) {
this.taskId = taskId;
this.delay = delay;
this.isRoutine = isRoutine;
this.param = param;
}
/**
*
* Must be called after {@link #taskType} initialized
*/
void encode() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
byte[] paramCode = param.getParamCode();
try {
dos.writeInt(taskId);
dos.writeInt((int)delay);
dos.writeBoolean(isRoutine);
dos.writeByte(taskType);
dos.writeInt(paramCode.length);
dos.write(paramCode);
dos.close();
baos.close();
} catch (IOException e) {
e.printStackTrace();
}
taskCode = baos.toByteArray();
}
public byte[] getTaskCode() {
return taskCode;
}
public String getOid() {
return oid;
}
public int getId() {
return taskId;
}
public int getType() {
return taskType;
}
void setType(int type) {
taskType = type;
}
void setOid(String oid) {
this.oid = oid;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -