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