0

I'm working with EXI, which encodes XML into a binary format and back.

For this I'm using the open source JAVA tool ExiProcessor, which is a executable JAR file and which makes this process very easy. Since I want to use it with C#, I need to exchange data between those two.

The easiest way is to write the XML data from C# to a file, read this file with ExiProcessor and then the other way round. But this isn't really fast.

Therefore I wonder what alternatives are there. I read that as of .NET Framework 4 you can use MemoryMappedFiles. I had a look, but it seems they only work between two applications that are using .NET Framework 4?

Is there any other way to speed up the process?

As a fallback I could use the JAVA sources and write my own application, but I would prefer to use the ExiProcessor as is.

user3666197
  • 1
  • 6
  • 43
  • 77
Ryo Shinzo
  • 51
  • 7

2 Answers2

1

For mixed environments like this, Apache Thrift is usually a good choice. Thrift is designed for lightweight, fast and easy to use RPC (and IPC) solutions. Amongst others, it supports both Java and C#. Might be worth a look.

If you want to stick with MMFs, this is also possible by just using the serialization part of Thrift and read/write date into/from a buffer or stream. You don't have to use the RPC stuff.

Have a lok at this question for a more exhaustive overview and a few links to other resources that help you getting started quickly.

Community
  • 1
  • 1
JensG
  • 12,102
  • 4
  • 40
  • 51
  • But this solution would require to modify the executable ExiProcessor JAR, correct? Since I not only need to implement something on C# side, but also add the corresponding counterpart on Java? This is what I would like to avoid, since I don't have much experience with Java. – Ryo Shinzo Sep 16 '14 at 11:37
  • True. I didn't read "*I would prefer to use the ExiProcessor as is*" this way. – JensG Sep 16 '14 at 14:40
0

I am not much sure , but if you are looking a way to use the jar,

You can try to convert the jar

http://www.ikvm.net/userguide/tutorial.html

or you can use a bridge like

http://jni4net.sourceforge.net/

hope this helps !!

Archangle
  • 302
  • 1
  • 4
  • 21
  • Doesn't help much, since ExiProcessor is no library, but an executable JAR. Therefore I cannot just convert it to C# and then execute it there in my code, can I? – Ryo Shinzo Sep 16 '14 at 12:23