aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/utils.scala
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-09 16:32:09 +0200
committerJoel Kronqvist <joel.kronqvist@iki.fi>2024-11-09 16:32:09 +0200
commit129b49a3876ceb68f271c311d5e45efb2e205300 (patch)
tree246a47a5990167c73b95fc6e02452de7f6aca6b3 /src/main/scala/utils.scala
parent239571e3408a3187953bef1dd5d516461bad0e31 (diff)
downloadscalevalapokalypsi-129b49a3876ceb68f271c311d5e45efb2e205300.tar.gz
scalevalapokalypsi-129b49a3876ceb68f271c311d5e45efb2e205300.zip
Made & implemented clearer protocol, added client functionality
Diffstat (limited to 'src/main/scala/utils.scala')
-rw-r--r--src/main/scala/utils.scala9
1 files changed, 9 insertions, 0 deletions
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