NIFI-7281 This closes #4159. Use BufferedInputStream in StandardSocketChannelRecordReader in order to support mark/reset

Signed-off-by: Joe Witt <joewitt@apache.org>
This commit is contained in:
Bryan Bende 2020-03-25 12:33:19 -04:00 committed by Joe Witt
parent 271de92046
commit 5784888082
No known key found for this signature in database
GPG Key ID: 9093BF854F811A1A
1 changed files with 3 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import org.apache.nifi.serialization.MalformedRecordException;
import org.apache.nifi.serialization.RecordReader;
import org.apache.nifi.serialization.RecordReaderFactory;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
@ -53,7 +54,8 @@ public class StandardSocketChannelRecordReader implements SocketChannelRecordRea
throw new IllegalStateException("Cannot create RecordReader because already created");
}
final InputStream in = socketChannel.socket().getInputStream();
final InputStream socketIn = socketChannel.socket().getInputStream();
final InputStream in = new BufferedInputStream(socketIn);
recordReader = readerFactory.createRecordReader(Collections.emptyMap(), in, -1, logger);
return recordReader;
}