Add size return to verify packet length

This commit is contained in:
Him188 2020-01-01 18:17:34 +08:00
parent 6b93ce3ccc
commit 82f1fda69c

View File

@ -38,9 +38,10 @@ fun BytePacketBuilder.writeShortLVByteArrayLimitedLength(array: ByteArray, maxLe
}
}
fun BytePacketBuilder.writeShortLVByteArray(byteArray: ByteArray) {
fun BytePacketBuilder.writeShortLVByteArray(byteArray: ByteArray): Int {
this.writeShort(byteArray.size.toShort())
this.writeFully(byteArray)
return byteArray.size
}
fun BytePacketBuilder.writeShortLVPacket(tag: UByte? = null, lengthOffset: ((Long) -> Long)? = null, builder: BytePacketBuilder.() -> Unit): Int =