You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Serializing a simple map to a byte array, persisting to a file, and then reading bytearray back from file fails with IndexOutOfBoundsException
To Reproduce
Steps to reproduce the behavior:
This is an example of a test that reproduces the problem
`
val mapToSerialize = Map("1" -> "Bananna", "2" -> "Apple", "3" -> "Cheese")
val path = Paths.get("/c/temp/testFile.bytes")
val serializedBytes = Base64.getEncoder.encodeToString(ScalaKryoInstantiator.defaultPool.toBytesWithClass(mapToSerialize))
if(!Files.exists(path.getParent)) Files.createDirectories(path.getParent)
val writer = new BufferedWriter(new FileWriter(path.toFile))
writer.write(serializedBytes )
writer.close()
val byteArray = FileUtils.readFileToByteArray(path.toFile)
val readFromFile = ScalaKryoInstantiator.defaultPool.fromBytes(byteArray).asInstanceOf[Map[String, String]]
`
Expected behavior
I would expect to be able to write the encoded byte array to file, read it back, and deserialize properly
Screenshots
N/A
Environment
Version 0.1.0
Scala 2.11
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
Serializing a simple map to a byte array, persisting to a file, and then reading bytearray back from file fails with IndexOutOfBoundsException
To Reproduce
Steps to reproduce the behavior:
This is an example of a test that reproduces the problem
`
val mapToSerialize = Map("1" -> "Bananna", "2" -> "Apple", "3" -> "Cheese")
val path = Paths.get("/c/temp/testFile.bytes")
val serializedBytes = Base64.getEncoder.encodeToString(ScalaKryoInstantiator.defaultPool.toBytesWithClass(mapToSerialize))
if(!Files.exists(path.getParent)) Files.createDirectories(path.getParent)
val writer = new BufferedWriter(new FileWriter(path.toFile))
writer.write(serializedBytes )
writer.close()
val byteArray = FileUtils.readFileToByteArray(path.toFile)
val readFromFile = ScalaKryoInstantiator.defaultPool.fromBytes(byteArray).asInstanceOf[Map[String, String]]
`
Expected behavior
I would expect to be able to write the encoded byte array to file, read it back, and deserialize properly
Screenshots
N/A
Environment
Version 0.1.0
Scala 2.11
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: