ITeye博客

android中将读回的xml inputstream打印为日志

googlelee · 2012-05-21 10:40 · Android · 移动开发 · Markdown

if(StringUtils.IsShowLog) {

try {

ByteArrayOutputStream os=new ByteArrayOutputStream();

byte[] b = new byte[4096];  

for (int n; (n = is.read(b)) != -1;) {

   StringUtils.logD(tag, ""+new String(b, 0, n));

   os.write(b, 0, n);

}

InputStream is_temp = new ByteArrayInputStream(os.toByteArray());

is = is_temp;

} catch (IOException e1) {

e1.printStackTrace();

}   

}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。