Try using the getMendixObject() method on the newobject. It should be in the generated proxy class for TestFile.
Core.storeFileDocumentContent(getContext(), newobject.getMendixObject(), inputStream);
Good luck!
I tried something a little different. The following does NOT give me an error, but it copies nothing. Mendix shows HasContents=true but the size is 0KB, which I verified after I downloaded the file locally. Does anyone know why the file (which is only 40K) isn’t copying from the inputstream?
for(int a = 0;a<length;a++) {
InputStream inputStream;
TestFile myobject = this.Parameter.get(a);
inputStream = Core.getFileDocumentContent(getContext(), __Parameter.get(a));
String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
myobject.setStringBody(result);
myobject.commit();
IMendixObject newobject = Core.instantiate(getContext(), "MusicBack.TestFile");
Core.storeFileDocumentContent(getContext(), newobject, "TEST.WAV", inputStream);
Core.commit(getContext(), newobject);
InputStream inputStream2;
inputStream2 = Core.getFileDocumentContent(getContext(), newobject);
String result2 = IOUtils.toString(inputStream2, StandardCharsets.UTF_8);
newobject.setValue(getContext(), "StringBody", result2);
Core.commit(getContext(), newobject);
}