fix #2450 add bufferSize
This commit is contained in:
parent
265a00f3fd
commit
f7a0988200
1 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue