2014-02-27 53 views

回答

3

一起來,看看它的類型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的閱讀實際內容,只得到保存它

元數據
相關問題