NiFi reads FlowFile in Processor

In the onTrigger method of the Processor, the content in the FlowFile can be obtained from the ProcessSession parameter, refer to some writing methods on the Internet, such as
session.read(flowFile, new InputStreamCallback() {

			@Override
			public void process(final InputStream in) throws IOException {
				
				final InputStream bin = new  BufferedInputStream(in);
				System.out.println(bin);
			}
		});


The content read out is always empty.

If you want to read the content, you can take the following methods
System.out.println(IOUtils.toString(in,Charset.defaultCharset()));


But I want to introduce the common-io package of apache
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326676532&siteId=291194637