exceptionfactory commented on code in PR #8842:
URL: https://github.com/apache/nifi/pull/8842#discussion_r1603784494


##########
nifi-api/src/main/java/org/apache/nifi/components/resource/Utf8TextResource.java:
##########
@@ -46,6 +47,11 @@ public InputStream read() throws IOException {
         return new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8));
     }
 
+    @Override
+    public InputStreamReader createReader() throws IOException {
+        return new InputStreamReader(this.read(), StandardCharsets.UTF_8);
+    }

Review Comment:
   Although this is convenient, it is best to avoid introducing it as an 
API-level method.



##########
nifi-api/src/main/java/org/apache/nifi/components/resource/ResourceReference.java:
##########
@@ -44,6 +45,15 @@ public interface ResourceReference {
      */
     InputStream read() throws IOException;
 
+    /**
+     * @return an InputStreamReader to read the contents of the resource
+     *
+     * @throws IOException if unable to obtain an InputStream from the resource
+     */
+    default InputStreamReader createReader() throws IOException {
+        return new InputStreamReader(this.read());
+    }

Review Comment:
   We should avoid introducing this default method because it defaults to the 
platform character encoding.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to