Hi, I want to get a binary representation of an ob...
# announcements
y
Hi, I want to get a binary representation of an object. The easier way I found was this one:
Copy code
val file = File("temp")
ObjectOutputStream(FileOutputStream(file)).use { it.writeObject(obj) }
return file.readBytes()
However, I really want to avoid using files. So, I'm wondering whether there is a better/shorter way to achieve the same result. Thanks 🙂
google 3