fix #2450 add bufferSize

This commit is contained in:
Shinsuke Sugaya 2020-05-07 21:36:25 +09:00
parent 265a00f3fd
commit f7a0988200

View file

@ -35,8 +35,15 @@ public class InputStreamThread extends Thread {
private final List<String> list = new LinkedList<>();
private final int bufferSize;
public InputStreamThread(final InputStream is, final String charset) {
this(is, charset, MAX_BUFFER_SIZE);
}
public InputStreamThread(final InputStream is, final String charset, final int bufferSize) {
super("InputStreamThread");
this.bufferSize = bufferSize;
try {
br = new BufferedReader(new InputStreamReader(is, charset));
@ -58,7 +65,7 @@ public class InputStreamThread extends Thread {
logger.debug(line);
}
list.add(line);
if (list.size() > MAX_BUFFER_SIZE) {
if (list.size() > bufferSize) {
list.remove(0);
}
}