public void browserSetFile(String fileName) {
        Document doc;
        String objectPath;

        final String textFileName = fileName;
        String mimetype = "text/plain; charset=UTF-8";

        System.out.print("Enter content: ");
        String content = readString();

        String filename = textFileName;

        byte[] buf = null;
        try {
            buf = content.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        ByteArrayInputStream input = new ByteArrayInputStream(buf);
        ContentStream contentStream = session.getObjectFactory().createContentStream(filename, buf.length, mimetype, input);

        if (browseFolder.isRootFolder()) {
            objectPath = browseFolder.getPath() + fileName;
        } else {
            objectPath = browseFolder.getPath() + "/" + fileName;
        }

        try {
            doc = (Document) session.getObjectByPath(objectPath);
            doc.setContentStream(contentStream, true);
        } catch (CmisObjectNotFoundException e) {
            System.out.println("Document not found: " + objectPath);
        }
    }