Is there any standard way or any service library for reading / navigating objects using serialized (via ObjectOutputStream) objects?
The problem I'm trying to solve is to update data that has been serialized using an ObjectOutputStream (legacy) and stored in the database. In my case, some internal fields were radically changed and renamed. I cannot read the object back using ObjectInputStream, since the values of the changed fields will be lost (set to null).
In particular, you might need to update it again in the future, so it would be better if I could replace the old data stored this way with XML serialization. But a general way to accomplish this task will require iteration through properties (their names, types, and values). I could not find a standard way to read such metadata from serialized data (for example, the Jackson library could read JSON as an object or as a map of properties and maps that you can easily manipulate).
Is there a low-level data library serialized using ObjectOutputStream? The result seems to contain information about serialized field names and their types. As a last resort, I could figure out the format, but I thought that someone could do it already, but I could not find any libraries.
For example, I had a class
public class TestCase implements Serializable
{
int id;
double doubleValue;
String stringValue;
public TestCase(int id, double doubleValue, String stringValue)
{
this.id = id;
this.doubleValue = doubleValue;
this.stringValue = stringValue;
}
}
public class TestCase implements Serializable
{
ComplexId id;
double doubleValue;
String stringValue;
public TestCase(ComplexId id, double doubleValue, String stringValue)
{
this.id = id;
this.doubleValue = doubleValue;
this.stringValue = stringValue;
}
}
class ComplexId implements Serializable
{
int staticId;
String uuid;
public ComplexId(int staticId, String uuid)
{
this.staticId = staticId;
this.uuid = uuid;
}
}
, , ( ) / ( ).