org.nuxeo.common.utils.FileUtils.getFileNameNoExt()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中org.nuxeo.common.utils.FileUtils.getFileNameNoExt()方法的一些代码示例,展示了FileUtils.getFileNameNoExt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.getFileNameNoExt()方法的具体详情如下:
包路径:org.nuxeo.common.utils.FileUtils
类名称:FileUtils
方法名:getFileNameNoExt

FileUtils.getFileNameNoExt介绍

暂无

代码示例

代码示例来源:origin: org.nuxeo.template.rendering/nuxeo-template-rendering-core

protected void setBlobAttributes(Blob result, TemplateBasedDocument templateBasedDocument) {
  // try to guess mimetype and extension of the resulting Blob
  MimetypeRegistry mreg = Framework.getService(MimetypeRegistry.class);
  String mimetype = "text/html";
  String extension = ".html";
  if (mreg != null) {
    String found_mimetype = guessMimeType(result, mreg);
    if (found_mimetype != null) {
      mimetype = found_mimetype;
      List<String> extensions = mreg.getExtensionsFromMimetypeName(mimetype);
      if (extensions != null && extensions.size() > 0) {
        extension = "." + extensions.get(0);
      }
    }
  }
  if ("text/xml".equalsIgnoreCase(mimetype)) {
    // because MimetypeRegistry return a stupid result for XML
    extension = ".xml";
  }
  result.setMimeType(mimetype);
  String targetFileName = FileUtils.getFileNameNoExt(templateBasedDocument.getAdaptedDoc().getTitle());
  result.setFilename(targetFileName + extension);
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-io

xdoc.putDocument(FileUtils.getFileNameNoExt(file.getName()), loadXML(file));
} else { // presume a blob
  xdoc.putBlob(file.getName(), Blobs.createBlob(file));

代码示例来源:origin: org.nuxeo.template.rendering/nuxeo-template-rendering-core

String targetFileName = FileUtils.getFileNameNoExt(templateBasedDocument.getAdaptedDoc().getTitle());

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-convert

protected Blob applyConverter(Blob blob, String converter, String destMimeType, Map<String, Serializable> params) {
  ConversionService cs = Framework.getService(ConversionService.class);
  BlobHolder bh = cs.convert(converter, new SimpleBlobHolder(blob), params);
  if (bh == null || bh.getBlob() == null) {
    return blob;
  } else {
    Blob result = bh.getBlob();
    MimetypeRegistry mtr = Framework.getService(MimetypeRegistry.class);
    String filename = FileUtils.getFileNameNoExt(blob.getFilename());
    filename = filename + "." + mtr.getExtensionsFromMimetypeName(destMimeType).get(0);
    result.setFilename(filename);
    if (result.getMimeType() == null) {
      result.setMimeType(destMimeType);
    }
    return result;
  }
}

相关文章