KLALB2.3
This commit is contained in:
@@ -1,41 +1,40 @@
|
||||
package org.kne.cloud.network.klalb;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class PINGPacket extends KLALBPacket {
|
||||
|
||||
private long time;
|
||||
|
||||
@Override
|
||||
protected void writeToStream(DataOutput dto) throws IOException {
|
||||
super.writeToStream(dto);
|
||||
dto.writeLong(time);
|
||||
}
|
||||
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
return header.getLong(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readFromStream(DataInput din) throws IOException {
|
||||
super.readFromStream(din);
|
||||
time=din.readLong();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getLength() {
|
||||
return super.getLength()+8;
|
||||
}
|
||||
|
||||
public PINGPacket() {
|
||||
super(PING);
|
||||
@Override
|
||||
protected int getHeaderSize() {
|
||||
return super.getHeaderSize()+8;
|
||||
}
|
||||
|
||||
public PINGPacket(long time) {
|
||||
super(PING);
|
||||
this.time=time;
|
||||
super(PING,-1);
|
||||
header.putLong(time);
|
||||
}
|
||||
public PINGPacket(ByteBuffer bb) {
|
||||
super(bb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PING";
|
||||
|
||||
Reference in New Issue
Block a user