How to get the image into mendix after javaaction

Hi Team, i am working on image compression by  using javaaction, after compressing the image is stored in my local machine  (C:\\UserData\\Z00P\\Documents\\Image compression\\Compressed\\sample_compressed.JPG) but i want to get the compressed image directly into mendix instead of storing in my local machine.
1 answers

You’d have to modify the java action to store the compress result into a file document. The CommunityCommons module has various actions that use this process, it comes down to getting your compression result as a byte array inputstream and then storing it to a target file, like

Core.storeFileDocumentContent(context, targetFile.getMendixObject(), byteArrayInputStream);

A good working example of this is the Base64DecodeToFile action, using a function in the commons’ StringUtils file.