public static boolean sendRequest(String request) { InputStream inputStream = null; try { URL url = new URL(request); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setReadTimeout(TIMEOUT); connection.setConnectTimeout(TIMEOUT); connection.setRequestMethod("POST"); connection.connect(); inputStream = connection.getInputStream(); while (inputStream.read() != -1); return true; } catch (IOException error) { return false; } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException secondError) { Log.w(RequestManager.class.getSimpleName(), secondError); } }}我如何从 inputreader.read() 读取数据?我想读取从服务器发回的数据
添加回答
举报
0/150
提交
取消