This commit is contained in:
Administrator
2025-04-24 10:16:38 +08:00
parent 6de65562be
commit 7267aec1fd
108 changed files with 7621 additions and 1890 deletions
@@ -4,19 +4,29 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Inet6Address;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.WritableByteChannel;
public class KLALBOutputStream extends DataOutputStream {
private WritableByteChannel channel;
public KLALBOutputStream(OutputStream out) throws IOException {
super(out);
this.channel=Channels.newChannel(out);
byte[]b=new byte[] {'K','L','A','L','B'};
write(b);
writeInt(CONST.bversion);
writeInt(CONST.sversion);
flush();
}
public void writePacket(KLALBPacket klb) throws IOException {
public void writeKLALBPacket(KLALBPacket klb) throws IOException {
writeInt((int) klb.getLength());
KLALBPacket.writeKLALBPacketToStream(this, klb);
}
public void writePacket(ByteBuffer kp) throws IOException {
writeInt( kp.limit());
channel.write(kp);
}
}