tags:

views:

38

answers:

1

Hello,

I would like to know and get an implementation help, if possible, about the best way to transfer very large amount to pure text from C to Java using JNI. ...jst want to add that I tried to put all text in one string, but at some point when the file reaches 140mb a kernell32.dll error(outside of JVM) occurs. I want to get as hish as 700mb, that's why i need a clean implementation. i thought about putting max number of text in each vector element, but didn;t know where to start.

thank you

A: 

I think I'd use a StringBuffer in Java and append fixed size chunks of strings to it. That is, read 50 or 100 MB of text (or until EOF) in C++, then call StringBuffer.append(String) from JNI.

You could start with 10 MB chunks first and see if it performs. If not, increase the chunk size. But I think also small chunk sizes should give reasonably fast results.

David Sauter