You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Mark Payne (Jira)" <ji...@apache.org> on 2020/09/08 14:57:00 UTC

[jira] [Commented] (NIFI-7792) Support inputstream for session.write

    [ https://issues.apache.org/jira/browse/NIFI-7792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17192261#comment-17192261 ] 

Mark Payne commented on NIFI-7792:
----------------------------------

Hi [~Moosheimer]. There does exist in the nifi-utils method a StreamUtils class that allows for copying from an InputStream to an OutputStream: {code}StreamUtils.copy(in, out);{code}
If the intent is purely to create a FlowFile whose contents are those in an InputStream, that method already exists on ProcessSession as well:
{code}
FlowFile importFrom(InputStream source, FlowFile destination);
{code}


> Support inputstream for session.write
> -------------------------------------
>
>                 Key: NIFI-7792
>                 URL: https://issues.apache.org/jira/browse/NIFI-7792
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>            Reporter: Kay-Uwe Moosheimer
>            Priority: Trivial
>
> When writing flowfile content with 
>  flowFile = *session.write*(flowFile, out -> \{...}
>  only a byte array can be used.
>  It would be an improvement if you could provide an InputStream too.
> So one would not have to do the copying oneself and insert possible errors.
> while ((length = in.read(buffer, 0, buffer.length)) != -1)
> { out.write(buffer, 0, length); }



--
This message was sent by Atlassian Jira
(v8.3.4#803005)