due to compatibility reasons, I need to be able to store a random C buffer inside of a Java String. THis means that the Java String should contain the exact same buffer information (i.e. byte sequence) as the original C buffer. How would I do that?
Unfortunately, I don't know what environment your coding in, Linux, Windows etc. But I'll assume Windows. First of all, strings are different in C and Java. In Java they are sequences of UTF-16 code points whereas C strings are null terminated sequence of bytes. I believe JNI has two the functions for manipulating these strings. One is "modified UTF-8" byte sequences and the other is arrays of UTF-16 values.
Windows has two types of strings ASCII and Unicode. If your C code is using ASCII strings then use the "modified UTF-8 conversion functions. Otherwise, if you are using Unicode strings then UTF-16 conversion functions are what you need.
Finally, I can't be of much help to you since my Java experience is minimal. But you do have to convert the strings as indicated above.