From ff805c250c0ac7a794c851bdbfc252ae30bc80f8 Mon Sep 17 00:00:00 2001 From: Edoardo La Greca Date: Fri, 20 Jun 2025 17:50:10 +0200 Subject: add readMessageSizeType method to NinePConnection --- src/main/kotlin/NinePConnection.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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 { + return Pair( + readInteger(4).toInt().toUInt(), + NinePMessageType.fromByte(readInteger(1).toByte()) + ) + } + // TODO: implement methods from NinePTranslator } \ No newline at end of file -- cgit v1.2.3