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

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

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();

}   

}