Android serialization file

I have a problem with file management ...

These are the files that I created using serialization, but so offline, in a java application.

And when I try to deserialize from an Android application, I get an error ...

I assume that this will not be supported unless you use the same libraries to serialize me using Java 1.6, while in the google api 4.0 utility ...

Any way to fix this?

Or do I need to write a small Android application and serialize there?

With respect and gratitude

kLvin

+4
source share
1 answer

Java serialization is very fragile and prone to hacking - it is good for short-term storage on local systems, and data usually will not survive JVM signatures or changes (you can get around this, but it is difficult). The best solution would be XML or JSON (less verbose). There are many libraries that will [un] arrange your objects in the tray (in | out) of these formats. Only some options:

  • jackson
  • google gson
  • XStream

Some rules of thumb for android

  • use syntax parsing, not DOM
  • see library sizes

My personal choice is the built-in JSON serializer based on the disabled GSON:

https://github.com/ko5tik/jsonserializer

(also available at maven central station)

0
source

Source: https://habr.com/ru/post/1432118/


All Articles