0

I have a Java application who create preference files with the ObjectInputStream class, ex :

FileOutputStream file = new FileOutputStream(path);
ObjectOutputStream oos = new ObjectOutputStream(file);
oos.writeObject(object);
oos.flush();
oos.close();

This method create files like : Click here

Now I want to properly read this file in a c# application, like you do it in java with for example :

ObjectInputStream = new ObjectInputStream(filestream);
CalendarLine lineSaved = (CalendarLine) ois.readObject();

Most of the solutions I found were with xml Serialize, but my java application create .ser files.

Thank for your help :)

NB : I Cannot change the java code to make other files.

PS : Sorry for my bad english ^^

4
  • 1
    "NB : I Cannot change the java code to make other files." That's very, very unfortunate. That means you'll basically have to port Java binary serialization to .NET, or find someone else that has. Java binary serialization was never really intended to be a portable (across languages) data format any more than C# binary serialization is,. Commented Jun 16, 2017 at 13:33
  • Rather then writing C# code to read Java serialized data, it might be easier to write a small Java program to read the serialized data, and write it back as JSON, XML, or some other portable format. Commented Jun 16, 2017 at 13:36
  • This page gives information about the format - you will see it is not a simple process. javaworld.com/article/2072752/… Commented Jun 16, 2017 at 13:38
  • Ok, it will not be as simple as i thought but anyway thank for your help guys :) Commented Jun 16, 2017 at 13:49

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.