code: private void createVersion(Node fileNode, InputStream inputStream, List<String> mixins) throws RepositoryException
     {
  
        if (!fileNode.isCheckedOut())
        {
           fileNode.checkout();
           fileNode.getSession().save();
        }
  
        updateContent(fileNode, inputStream, mixins);
        fileNode.getSession().save();
        fileNode.checkin();
        fileNode.getSession().save();
     }
docs: Creates the new version of file.
  
  @param fileNode file node
  @param inputStream input stream that contains the content of file
  @param mixins list of mixins
  @throws RepositoryException {@link RepositoryException}