0
votes

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)
1
what are contents that you try to write into flowfile? What issue you have faced? - Mister X

1 Answers

1
votes

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)