URL url =newURL(path);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setReadTimeout(8000);
httpURLConnection.setConnectTimeout(8000);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
int code = httpURLConnection.getResponseCode();
if (code == 200) {
InputStream inputStream = httpURLConnection.getInputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); int len = 0;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, len); } List list = new ArrayList();
Gson gson = new Gson();
myBean0 myBean = gson.fromJson(outputStream.toString(), com.example.day09_0714.myBean0.class);
list = myBean.newslist;