String type = fileContent.getContentType();
// jcr:encoding is not mandatory
String encoding = fileContent.getEncoding();
InputStream stream = fileContent.downloadFile();
try {
Metadata metadata = new Metadata();
metadata.set(Metadata.CONTENT_TYPE, type);
if (encoding != null) {
metadata.set(Metadata.CONTENT_ENCODING, encoding);