I want to create a Java File object in memory (without creating a physical file) and populate its content with a byte array.
Can this be done?
T
Can you paste the full stack trace? There is no such thing as an "in memory" file. Using a ByteArrayInputStream should be sufficient.
You need to implement Resource#getFilename(). Try the following:
helper.addInline("cImage", new ByteArrayResource(imageByteArr){
@Override
public String getFilename() {
return fileName;
}
});