String mimetype = "text/html; charset=UTF-8";
String content1 = "Im Walde rauscht ein Wasserfall. Wenn's nicht mehr rauscht ist's Wasser all.";
byte[] buf1 = content1.getBytes("UTF-8");
ByteArrayInputStream in1 = new ByteArrayInputStream(buf1);
ContentStream contentStream1 = session.getObjectFactory().createContentStream(filename1, buf1.length, mimetype,
in1);
assertNotNull(contentStream1);
ObjectId id = session.createDocument(properties, parentId, contentStream1, VersioningState.NONE);
assertNotNull(id);
// set and verify content
String filename2 = UUID.randomUUID().toString();
String content2 = "abc";
byte[] buf2 = content2.getBytes("UTF-8");
ByteArrayInputStream in2 = new ByteArrayInputStream(buf2);
ContentStream contentStream2 = session.getObjectFactory().createContentStream(filename2, buf2.length, mimetype,
in2);
assertNotNull(contentStream2);
Document doc = (Document) session.getObject(id);
assertNotNull(doc);