Finish InPacket & OutPacket implementations

This commit is contained in:
P0nk
2021-06-20 21:27:50 +02:00
parent f3faee2e16
commit aaf4b558f3
5 changed files with 24 additions and 26 deletions

View File

@@ -23,15 +23,12 @@ public class ByteBufOutPacket implements OutPacket {
this.byteBuf = byteBuf;
}
@Override
public short getHeader() {
return byteBuf.getShortLE(0);
}
@Override
public byte[] getBytes() {
// TODO implement
throw new UnsupportedOperationException();
byte[] bytes = new byte[byteBuf.readableBytes()];
int readerIndex = byteBuf.readerIndex();
byteBuf.getBytes(readerIndex, bytes);
return bytes;
}
@Override
@@ -50,7 +47,7 @@ public class ByteBufOutPacket implements OutPacket {
}
@Override
public void writeShort(short value) {
public void writeShort(int value) {
byteBuf.writeShortLE(value);
}
@@ -82,7 +79,7 @@ public class ByteBufOutPacket implements OutPacket {
}
@Override
public void skip(int bytesToSkip) {
writeBytes(new byte[bytesToSkip]);
public void skip(int numberOfBytes) {
writeBytes(new byte[numberOfBytes]);
}
}