使用 FileNet Java API 版本 5.1.0.3
我正在尝试将大文档上传到 P8。我正在使用 FileInputStream 读取文件并将输入流设置为 contentTransfer.setCaptureSource(file); 我收到 OOM 异常(下面的完整堆栈跟踪)。看起来它试图读取堆内存中的整个文档,但这不是我想要的,我想将文档流式传输到 P8。
代码
//Get CE Connetcion
//Create Subject
//Push Subject
//Get Domain (domain)
ObjectStore os = null;
objectStoreName = "COS"
os = Factory.ObjectStore.fetchInstance(domain, objectStoreName, null);
//Get Folder
Folder folder=null;
folderName = ''/Sample";
folder=Factory.Folder.fetchInstance(os, folderName, null);
//Get the File details
InputStream file = "";
String fileName = "";
int fileSize = "";
// Create Document
String docClass = "dcumnet class name";
Document doc = Factory.Document.createInstance(os, docClass);
if (file != null && fileSize > 0) {
ContentTransfer contentTransfer = Factory.ContentTransfer.createInstance();
contentTransfer.setCaptureSource(file);
contentElementList.add(contentTransfer);
doc.set_ContentElements(contentElementList);
contentTransfer.set_RetrievalName(fileName);
doc.set_MimeType(getMimetype(fileName));
}
//Check-in the doc
doc.checkin(AutoClassify.DO_NOT_AUTO_CLASSIFY,CheckinType.MAJOR_VERSION);
//Get and put the doc properties
String documentName =""
Properties p = doc.getProperties();
p.putValue("DocumentTitle","abcd");
p.putValue("Name","Rakesh");
p.putValue("Number","01234");
doc.save(RefreshMode.REFRESH)
你能帮忙吗,如何将更大的文件作为流发送到 P8?
Caused by: java.lang.OutOfMemoryError: Java heap space
at weblogic.utils.io.UnsyncByteArrayOutputStream.resizeBuffer(UnsyncByteArrayOutputStream.java:59) ~[com.bea.core.utils_1.10.0.0.jar:1.10.0.0]
at weblogic.utils.io.UnsyncByteArrayOutputStream.write(UnsyncByteArrayOutputStream.java:89) ~[com.bea.core.utils_1.10.0.0.jar:1.10.0.0]
at com.filenet.apiimpl.wsi.MtomOutputStream.write(MtomOutputStream.java:39) ~[Jace.jar:dap501.003.019]
at com.filenet.apiimpl.wsi.AttachmentHelperNst.spillAndClearAttachments(AttachmentHelperNst.java:137) ~[Jace.jar:dap501.003.019]
at com.filenet.apiimpl.wsi.ServiceSessionNst.bCloseSoapEnvelopeAndWriteAttachments(ServiceSessionNst.java:262) ~[Jace.jar:dap501.003.019]
at com.filenet.apiimpl.wsi.ServiceSessionNst.cReqRespPath(ServiceSessionNst.java:159) ~[Jace.jar:dap501.003.019]
at com.filenet.apiimpl.wsi.ServiceSessionNst.executeChanges(ServiceSessionNst.java:71) ~[Jace.jar:dap501.003.019]
at com.filenet.apiimpl.util.SessionHandle.executeChanges(SessionHandle.java:130) ~[Jace.jar:dap501.003.019]
at com.filenet.apiimpl.core.Session.callExecuteChanges(Session.java:142) ~[Jace.jar:dap501.003.019]
at com.filenet.apiimpl.core.Session.executeChanges(Session.java:525) ~[Jace.jar:dap501.003.019]
at com.filenet.apiimpl.core.Session.executeChange(Session.java:816) ~[Jace.jar:dap501.003.019]
at com.filenet.apiimpl.core.IndependentlyPersistableObjectImpl.save(IndependentlyPersistableObjectImpl.java:83) ~[Jace.jar:dap501.003.019]