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 ^^

Drarox
  • 11
  • 3
  • 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,. – Jon Skeet Jun 16 '17 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. – Andreas Jun 16 '17 at 13:36
  • This page gives information about the format - you will see it is not a simple process. http://www.javaworld.com/article/2072752/the-java-serialization-algorithm-revealed.html – PaulF Jun 16 '17 at 13:38
  • Ok, it will not be as simple as i thought but anyway thank for your help guys :) – Drarox Jun 16 '17 at 13:49

0 Answers0