-
-
Save kolemannix/4bd1ebcc779d219f00e17176eabda836 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Point(x: Int, y: Int) | |
val serializePoint = { point: Point => s"${point.x},${point.y}".getBytes("UTF-8") } | |
val deserializePoint = { bytes: Array[Byte] => | |
val x :: y :: Nil = new String(bytes, "UTF-8").split(",").toList.map(_.toInt) | |
Point(x, y) | |
} | |
val point = Point(3, 4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment