Initial commit

This commit is contained in:
Flare Microsystems
2024-11-08 09:01:36 -08:00
commit 71d118f160
43 changed files with 1100 additions and 0 deletions

View File

@@ -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();
}
}