一起來,看看它的類型cm:content
與否:
QName nodeType = nodeService.getType(nodeRef);
if (! dictionaryService.isSubClass(nodeType, ContentModel.TYPE_CONTENT)) {
// Not content, so content can't be binary
return false;
}
接下來,你需要獲取Content
節點屬性,which'll是一個對象contentData內容,最後檢查的MIME類型在那。
ContentData contentData = (ContentData)nodeService.getProperty(
nodeRef, ContentModel.PROP_CONTENT);
String mimetype = contentData.getMimetype();
if (mimetype == null) {
// No idea...
} else if (mimetype.startsWith("text/")) {
// Shouldn't be binary
return false;
} else {
// Most likely binary, but there are a few unusual mimetypes
// not under the text/* range that are text...
return true;
}
你不需要去或contentService的閱讀實際內容,只得到保存它
元數據