How to Convert Fileoutputstream into Mendix File Object

I am calling a Java action  Input parameter (File) type . somehow i got to know that convert that mendix object into File Type using  ( InputStream f = Core.getFileDocumentContent(context, yourFileDocumentObject.getMendixObject() ) Method. In the same way how to convert File into Mendix Object ( as a return type ).   This is new File created in java action      FileOutputStream output= new FileOutputStream("C:\\Users\\TT-USER\\Desktop\\Demo4.docx");   Now i want to return this output as mendix object   I hope any one can help me !
1 answers

You need to use the storeFileDocumentContent method in the Core API to store the contents of an InputStream (not an OutputStream) into a FileDocument.,com.mendix.systemwideinterfaces.core.IMendixObject,java.lang.String,

You will need to have created a FileDocument object beforehand to pass into this call. You can pass this into your Java Action, or create one using the generated proxy classes. Once this has been stored, you can use the getMendixObject() method on the Mendix FileDocument object to return it from your Java Action.

Hope this helps.