标签:java io ar sp on new ad c as
public static String InputStream2String(InputStream in, String encoding) { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] data = new byte[4096]; int count = -1; try { while((count=in.read(data, 0, 4096)) != -1) { outStream.write(data, 0, count); } } catch (IOException e) { e.printStackTrace(); } data = null; String str = null; try { str = new String(outStream.toByteArray(), encoding); } catch (IOException e) { e.printStackTrace(); } return str; }
标签:java io ar sp on new ad c as
原文地址:http://my.oschina.net/u/923087/blog/307638