Using C# to serialize a Java deserializable object -


I have two applications that need to talk to each other. App1 should be able to serialize an object Which App2 can deserialize again, done easily, right? Here's the problem; App1 is C # based, App2 is Java based. Therefore, app 1 must write the file in the Java binary file format. How can this be done?

The way I look at it, I have two options: First, there is some way to serialize a Java object in C #, so that App1 creates just the right file. My second option would be to write a converter in Java which reads in a file and serializes the object according to the object and the new populated object. In this way, the C # app will only have to type some sort of formatted text file that the converter then interprets.

I can not make any changes to the Java application.

How should this be done?

Update:

The Java application is already in the hands of the customers, so changing the serialization scheme will cause the customers to have existing data incompatible. The Java app uses native Java serialization while dealing with this object. Java app can be modified

The C # app uses protocol buffers to serialize your data.

The best answer is Option 3: Use language-neutral serialization scheme.

I use javascript. Thunder is another option, Protocol buffers which I believe are focused more on RPC, but also should be used for serialization as well as XML or custom binary formats other options.

EDIT: Sorry, it's not noticed that you can not make changes to the Java application. He said that the best way to do this would be to create a well-defined format of its own, write a Java app that can read that format, then outputs a serialized Java object to the legacy app.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -