@Override public InputStream getContentInputStream() throws ContentIOException { InputStream result = delegatee.getContentInputStream(); if (null == releaseableResource) { releaseableResource = result; } return result; }
@Override public InputStream getContentInputStream() throws ContentIOException { InputStream result = delegatee.getContentInputStream(); if (null == releaseableResource) { releaseableResource = result; } return result; }
ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); InputStream originalInputStream = reader.getContentInputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); final int BUF_SIZE = 1 << 8; //1KiB buffer byte[] buffer = new byte[BUF_SIZE]; int bytesRead = -1; while((bytesRead = originalInputStream.read(buffer)) > -1) { outputStream.write(buffer, 0, bytesRead); } originalInputStream.close(); byte[] binaryData = outputStream.toByteArray();
public Reader getReader(String encoding) throws IOException { inputStream = conn.getContentInputStream(); return new InputStreamReader(inputStream, conn.getEncoding()); }
@Override protected void transformInternal(ContentReader reader, ContentWriter writer, TransformationOptions options) throws Exception { // just stream it writer.putContent(reader.getContentInputStream()); }
@Override protected void transformInternal(ContentReader reader, ContentWriter writer, TransformationOptions options) throws Exception { // just stream it writer.putContent(reader.getContentInputStream()); }
public InputStream readFile(NodeRef fileRef) { return fContentService.getReader(fileRef, ContentModel.PROP_CONTENT).getContentInputStream(); }
public Reader getReader(String encoding) throws IOException { inputStream = conn.getContentInputStream(); return new InputStreamReader(inputStream, conn.getEncoding()); }
/** utility function for parsing xml */ public static Document parse(final NodeRef nodeRef, final ContentService contentService) throws SAXException, IOException { final ContentReader contentReader = contentService.getReader(nodeRef, ContentModel.TYPE_CONTENT); final InputStream in = contentReader.getContentInputStream(); return XMLUtil.parse(in); }
@Override public InputStream openContentStream(NodeRef nodeRef) throws ActualEnvironmentException { ContentReader contentReader = apiFacet.getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT); return contentReader.getContentInputStream(); }
@Override public InputStream openContentStream(NodeRef nodeRef) throws ActualEnvironmentException { ContentReader contentReader = apiFacet.getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT); return contentReader.getContentInputStream(); }
/** utility function for parsing xml */ public static Document parse(final NodeRef nodeRef, final ContentService contentService) throws SAXException, IOException { final ContentReader contentReader = contentService.getReader(nodeRef, ContentModel.TYPE_CONTENT); final InputStream in = contentReader.getContentInputStream(); return XMLUtil.parse(in); }
public InputStream getInputStream() { ContentService contentService = services.getContentService(); ContentReader reader = contentService.getReader(nodeRef, property); return (reader != null && reader.exists()) ? reader.getContentInputStream() : null; }
public InputStream getInputStream() { ContentService contentService = services.getContentService(); ContentReader reader = contentService.getReader(nodeRef, property); return (reader != null && reader.exists()) ? reader.getContentInputStream() : null; }
public InputStream readFile(NodeRef base, String path) { NodeRef fileRef = lookup(base, path).getFirst(); if (fileRef == null) { throw new AlfrescoRuntimeException("Not Found: " + path); } return fContentService.getReader(fileRef, ContentModel.PROP_CONTENT).getContentInputStream(); }
public InputStream readFile(NodeRef base, String path) { NodeRef fileRef = lookup(base, path).getFirst(); if (fileRef == null) { throw new AlfrescoRuntimeException("Not Found: " + path); } return fContentService.getReader(fileRef, ContentModel.PROP_CONTENT).getContentInputStream(); }
public boolean isDefinitionDeployed(NodeRef workflowDefinition) { if (!nodeService.getType(workflowDefinition).equals(WorkflowModel.TYPE_WORKFLOW_DEF)) { throw new WorkflowException( "Node " + workflowDefinition + " is not of type 'bpm:workflowDefinition'"); } String engineId = (String) nodeService.getProperty(workflowDefinition, WorkflowModel.PROP_WORKFLOW_DEF_ENGINE_ID); ContentReader contentReader = contentService.getReader(workflowDefinition, ContentModel.PROP_CONTENT); return isDefinitionDeployed(engineId, contentReader.getContentInputStream(), contentReader.getMimetype()); }
public WorkflowDeployment deployDefinition(NodeRef definitionContent) { if (!nodeService.getType(definitionContent).equals(WorkflowModel.TYPE_WORKFLOW_DEF)) { throw new WorkflowException( "Node " + definitionContent + " is not of type 'bpm:workflowDefinition'"); } String engineId = (String) nodeService .getProperty(definitionContent, WorkflowModel.PROP_WORKFLOW_DEF_ENGINE_ID); ContentReader contentReader = contentService.getReader(definitionContent, ContentModel.PROP_CONTENT); return deployDefinition(engineId, contentReader.getContentInputStream(), contentReader.getMimetype()); }
public boolean isDefinitionDeployed(NodeRef workflowDefinition) { if (!nodeService.getType(workflowDefinition).equals(WorkflowModel.TYPE_WORKFLOW_DEF)) { throw new WorkflowException( "Node " + workflowDefinition + " is not of type 'bpm:workflowDefinition'"); } String engineId = (String) nodeService.getProperty(workflowDefinition, WorkflowModel.PROP_WORKFLOW_DEF_ENGINE_ID); ContentReader contentReader = contentService.getReader(workflowDefinition, ContentModel.PROP_CONTENT); return isDefinitionDeployed(engineId, contentReader.getContentInputStream(), contentReader.getMimetype()); }
public WorkflowDeployment deployDefinition(NodeRef definitionContent) { if (!nodeService.getType(definitionContent).equals(WorkflowModel.TYPE_WORKFLOW_DEF)) { throw new WorkflowException( "Node " + definitionContent + " is not of type 'bpm:workflowDefinition'"); } String engineId = (String) nodeService .getProperty(definitionContent, WorkflowModel.PROP_WORKFLOW_DEF_ENGINE_ID); ContentReader contentReader = contentService.getReader(definitionContent, ContentModel.PROP_CONTENT); return deployDefinition(engineId, contentReader.getContentInputStream(), contentReader.getMimetype()); }