in src/main/java/com/univocity/parsers/common/input/AbstractCharInputReader.java [187:234]
private void updateBuffer() {
if (!commentProcessing && length - recordStart > 0 && buffer != null && !skipping) {
tmp.append(buffer, recordStart, length - recordStart);
}
recordStart = 0;
reloadBuffer();
charCount += i;
i = 0;
if (length == -1) {
stop();
incrementLineCount = true;
}
if (inputAnalysisProcesses != null) {
if (length > 0 && length <= 4) {
int tmpLength = length;
char[] tmp = Arrays.copyOfRange(buffer, 0, length + 1); // length + 1 to assist CSV detection process: length < buffer.length indicates all data was read into the buffer.
//sets processes temporarily to null to prevent them running if method `unwrapInputStream` is called.
List<InputAnalysisProcess> processes = inputAnalysisProcesses;
inputAnalysisProcesses = null;
reloadBuffer();
inputAnalysisProcesses = processes;
if (length != -1) {
char[] newBuffer = new char[tmpLength + buffer.length];
System.arraycopy(tmp, 0, newBuffer, 0, tmpLength);
System.arraycopy(buffer, 0, newBuffer, tmpLength, length);
buffer = newBuffer;
length += tmpLength;
} else {
buffer = tmp;
length = tmpLength;
}
}
try {
for (InputAnalysisProcess process : inputAnalysisProcesses) {
process.execute(buffer, length);
}
} finally {
if (length > 4) {
inputAnalysisProcesses = null;
}
}
}
}