dan-s1 commented on code in PR #7952:
URL: https://github.com/apache/nifi/pull/7952#discussion_r1414467199


##########
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/AbstractCSVRecordReader.java:
##########
@@ -158,4 +180,46 @@ protected String trim(String value) {
     public RecordSchema getSchema() {
         return schema;
     }
+
+    /**
+     * This method searches using the specified Reader character-by-character 
until the
+     * record separator is found.
+     * @param reader the Reader providing the input
+     * @param recordSeparator the String specifying the end of a record in the 
input
+     * @throws IOException if an error occurs during reading, including not 
finding the record separator in the input
+     */
+    protected void readNextRecord(Reader reader, String recordSeparator) 
throws IOException {
+        int indexIntoSeparator = 0;
+        int recordSeparatorLength = recordSeparator.length();
+        int code = reader.read();
+        while (code != -1) {
+            char nextChar = (char)code;
+            if (recordSeparator.charAt(indexIntoSeparator) == nextChar) {
+                if (++indexIntoSeparator == recordSeparatorLength) {
+                    // We have matched the separator, return the string built 
so far

Review Comment:
   ```suggestion
                       // Short circuit as the separator indicates a record has 
been read
   ```



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to