在执行我的项目时,我在 logcat 中收到如下所示的错误:
05-12 12:43:17.268:INFO/global(801):BufferedInputStream 构造函数中使用的默认缓冲区大小。如果需要 8k 缓冲区,最好是明确的。
我的代码如下所示。在这里,我传入的数据commonParser()
是从 Web 服务获得的长响应。
public void commonParser(String data)
{
try
{
if(data!=null)
{
InputStream is = new ByteArrayInputStream(data.getBytes());
Reader reader = new InputStreamReader(is, "UTF-8");
InputSource inputSource = new InputSource(reader);
inputSource.setEncoding("UTF-8");
SAXParser sp = SAXParserFactory.newInstance().newSAXParser();
sp.parse(inputSource, this);
}
} catch (UnsupportedEncodingException e) {
System.out.println("Common Parser Unsupported Encoding :: "+e);
} catch (ParserConfigurationException e) {
System.out.println("Parse Config error"+e);
} catch (SAXException e) {
System.out.println("Sax error "+e);
} catch (IOException e) {
System.out.println("IO Error "+e);
}
}
logcat 响应建议我使用 8k 缓冲区大小,但我不知道如何为BufferedInputStream
.