Mary Jane
Mary Jane

Reputation: 139

Nifi : write to flowfile

I am trying to write to the flowfile in Nifi using groovy with the outputStream ( which is a bytearrayoutputstream). However, the size that i write to the flowfile is zero. Am i doing it wrong ? thanks in advance.

code: FlowFile newFlowFile = sess.create();

newFlowFile = sess.write(newFlowFile, { out ->
    outputStream
} as OutputStreamCallback)

Upvotes: 0

Views: 3482

Answers (1)

daggett
daggett

Reputation: 28634

if the outputStream is an bytearrayoutputstream then you can use ByteArrayOutputStream.writeTo(stream) method to write content of your bytearray to other output stream.

newFlowFile = sess.write(newFlowFile, { out ->
    outputStream.writeTo(out)
} as OutputStreamCallback)

Upvotes: 2

Related Questions