blob: 7411101bc27eed7afee03ec61318c8cb736702fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package com.nis.util;
import cn.hutool.core.util.StrUtil;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
public class BufferReaderWrapper extends BufferedReader
{
public Reader in;
// public static final int MAX_STR_LEN=1024;
public BufferReaderWrapper(Reader in) {
super(in);
this.in=in;
}
public String load() throws IOException {
StringBuffer sb = new StringBuffer();
int intC;
while ((intC = in.read()) != -1) {
char c = (char) intC;
if (c == '\n') {
break;
}
/*if (sb.length() >= MAX_STR_LEN) {
throw new IOException("input too long");
}*/
sb.append(c);
}
return StrUtil.isEmpty(sb.toString()) ? null : sb.toString();
}
}
|