Initial commit
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package com.flaremicro.crossjeeves.net.packet;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.flaremicro.crossjeeves.net.NetworkHandler;
|
||||
|
||||
public class Packet127KeepAlive extends Packet{
|
||||
long fileId;
|
||||
short chunkSize;
|
||||
byte[] fileChunk;
|
||||
|
||||
public Packet127KeepAlive(){
|
||||
}
|
||||
|
||||
public Packet127KeepAlive(long fileId, byte[] fileChunk){
|
||||
this.fileId = fileId;
|
||||
this.chunkSize = (short)fileChunk.length;
|
||||
this.fileChunk = fileChunk;
|
||||
}
|
||||
|
||||
public void recievePacket(DataInputStream in) throws IOException {
|
||||
fileId = in.readLong();
|
||||
}
|
||||
|
||||
public void sendPacket(DataOutputStream out) throws IOException {
|
||||
super.sendPacket(out);
|
||||
out.writeLong(fileId);
|
||||
out.writeShort(chunkSize);
|
||||
out.write(fileChunk);
|
||||
}
|
||||
|
||||
public void processPacket(NetworkHandler networkHandler){
|
||||
networkHandler.handlePacket(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet cloneTypeOnly() {
|
||||
return new Packet127KeepAlive();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user