本文整理汇总了Java中org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl.setFileName方法的典型用法代码示例。如果您正苦于以下问题:Java ContentStreamImpl.setFileName方法的具体用法?Java ContentStreamImpl.setFileName怎么用?Java ContentStreamImpl.setFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl
的用法示例。
在下文中一共展示了ContentStreamImpl.setFileName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUniqueDocument
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl; //导入方法依赖的package包/类
private Document createUniqueDocument(Folder newFolder)
throws UnsupportedEncodingException {
String uniqueName = getUniqueName();
Map<String, Object> uProperties = new HashMap<String, Object>();
uProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
uProperties.put(PropertyIds.NAME, uniqueName);
ContentStreamImpl contentStream = new ContentStreamImpl();
contentStream.setFileName("bob");
String shortString = "short";
contentStream.setStream(new ByteArrayInputStream(shortString.getBytes("UTF-8")));
contentStream.setLength(new BigInteger("5"));
contentStream.setMimeType("text/plain");
Document uniqueDocument = newFolder.createDocument(uProperties, contentStream, VersioningState.MAJOR);
return uniqueDocument;
}
示例2: getContentStream
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl; //导入方法依赖的package包/类
public ContentStream getContentStream(){
// compile data
ContentStreamImpl result = new ContentStreamImpl();
result.setFileName(getName());
try {
result.setLength(BigInteger.valueOf(getPropertyLength(getNode(), CMISConstants.GREG_DATA)));
if(getNode().getContent() != null){
String mimeType = getNode().getProperty(CMISConstants.GREG_MIMETYPE);
result.setMimeType(mimeType);
//result.setMimeType(getNode().getMediaType());
} else {
result.setMimeType(null);
}
if(getNode().getContent() != null){
InputStream inputStream = getNode().getContentStream();
result.setStream(new BufferedInputStream(inputStream)); // stream closed by consumer
} else {
result.setStream(null);
}
} catch (RegistryException e) {
throw new CmisRuntimeException(e.getMessage(), e);
}
return result;
}