Github user markap14 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/135#discussion_r50327323
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitText.java
---
@@ -143,26 +165,12 @@ protected void init(final
ProcessorInitializationContext context) {
return properties;
}
- private int readLines(final InputStream in, final int maxNumLines,
final OutputStream out, final boolean keepAllNewLines) throws IOException {
- int numLines = 0;
- for (int i = 0; i < maxNumLines; i++) {
- final long bytes = countBytesToSplitPoint(in, out,
keepAllNewLines || (i != maxNumLines - 1));
- if (bytes <= 0) {
- return numLines;
- }
-
- numLines++;
- }
-
- return numLines;
- }
-
- private long countBytesToSplitPoint(final InputStream in, final
OutputStream out, final boolean includeLineDelimiter) throws IOException {
+ private int readLine(final InputStream in, final OutputStream out,
+ final boolean includeLineDelimiter) throws
IOException {
int lastByte = -1;
- long bytesRead = 0L;
+ int bytesRead = 0;
while (true) {
- in.mark(1);
--- End diff --
Trying to understand the logic here - why was this line removed? It looks
like it is marked so that down below, on line 206 we can call in.reset() - with
this removed, if we get to that line, where in.reset() is called, I believe it
will thrown an IOException.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---