代码:
JSONObject config = new JSONObject(IOUtils.readString(request .getServletContext().getResourceAsStream("/WEB-INF/conf/update0.conf")));
{ "version_code":2, "description":"album_mobile" }
public class IOUtils { public static String readString(InputStream is) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] b = new byte[500]; int temp = 0; try { while((temp = is.read(b, 0, 500)) != -1) { baos.write(b, 0, temp); } } catch (IOException e) { e.printStackTrace(); } return new String(baos.toByteArray()); } }