diff options
author | Edoardo La Greca | 2025-06-20 17:50:10 +0200 |
---|---|---|
committer | Edoardo La Greca | 2025-06-20 17:50:10 +0200 |
commit | ff805c250c0ac7a794c851bdbfc252ae30bc80f8 (patch) | |
tree | c57a98123c9819be84361aa5e3d8bae7b3ca8e6a | |
parent | 3b9056002ba2f21e10481b6bedc47f9b1d572f27 (diff) |
add readMessageSizeType method to NinePConnection
-rw-r--r-- | src/main/kotlin/NinePConnection.kt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/kotlin/NinePConnection.kt b/src/main/kotlin/NinePConnection.kt index 73ab5fa..ee9d5ba 100644 --- a/src/main/kotlin/NinePConnection.kt +++ b/src/main/kotlin/NinePConnection.kt @@ -63,5 +63,18 @@ class NinePConnection(netPackTrans: NetworkPacketTransporter) : NinePTranslator return String(this.npt.receiveFixed(length.toULong()).toByteArray()) } + /** + * Read the message size and type. + * + * @return A pair in which the first element is the message size in bytes and the second is the message type as a + * [NinePMessageType] constant. + */ + private fun readMessageSizeType(): Pair<UInt, NinePMessageType> { + return Pair( + readInteger(4).toInt().toUInt(), + NinePMessageType.fromByte(readInteger(1).toByte()) + ) + } + // TODO: implement methods from NinePTranslator }
\ No newline at end of file |