//服务类 流的读取工具,可以直接使用
public class StreamTools {
public static String readFromFile(InputStream is) {try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len =is.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
baos.close();
is.close();
return baos.toString();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}