String repositoryId = session.getRepositoryInfo().getId();
Holder<String> objectIdHolder = new Holder<String>(objectId);
Boolean overwriteFlag = true;
byte[] newContentByteArray = newContent.getBytes();
InputStream stream = new ByteArrayInputStream(newContentByteArray);
ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(newContentByteArray), "text/plain", stream);
ObjectService objectService = session.getBinding().getObjectService();
objectService.setContentStream(repositoryId, objectIdHolder, overwriteFlag, null, contentStream, null);
}