You could try like this:
ContentStream contentStream = null;
try {
contentStream = new ContentStreamImpl("test.jpg", null, "image/jpeg", new FileInputStream("c:/test.jpg"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
if (contentStream != null) {
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.NAME, contentStream.getFileName());
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
Document doc = session.getRootFolder().createDocument(properties, contentStream , null);
}
Regards,
Glenn