From 129b49a3876ceb68f271c311d5e45efb2e205300 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sat, 9 Nov 2024 16:32:09 +0200 Subject: Made & implemented clearer protocol, added client functionality --- src/main/scala/utils.scala | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/main/scala/utils.scala (limited to 'src/main/scala/utils.scala') diff --git a/src/main/scala/utils.scala b/src/main/scala/utils.scala new file mode 100644 index 0000000..f230be7 --- /dev/null +++ b/src/main/scala/utils.scala @@ -0,0 +1,9 @@ +package o1game.utils + +/** Converts this string to an array of bytes (probably for transmission). + * + * @param str the string to convert + * @return an array of bytes representing the string in UTF8. + */ +def stringToByteArray(str: String): Array[Byte] = + str.toVector.map(_.toByte).toArray -- cgit v1.2.3