Is this a safe way to write an object using java s...
# announcements
i
Is this a safe way to write an object using java serialization?
Copy code
ObjectOutputStream(GZIPOutputStream(Files.newOutputStream(output))).use {
            it.writeObject(model)
        }
When I try to read it I’m getting errors that might indicate the file was truncated. This is how I’m reading it:
Copy code
val model = ObjectInputStream(GZIPInputStream(Files.newInputStream(modelsPath.resolve(modelFile)))).use {
        it.readObject() as RModel
}