我有java.io.Reader对象:
in = request.getReader(); // put the stream in blocking mode
之后,我想从这个Reader中获取String对象。
final char[] buf = new char[128];
int read;
StringBuilder builder = new StringBuilder();
while ((read = in.read(buf)) != -1) {
builder.append(buf, 0, read);
}
System.out.println(builder.toString());
这回复我这样的字符串:
ÑÑоÑ
如何使用UTF8字符集解析此Reader?