B
b83503104
Hi,
I'm trying to understand somebody's code. I've listed some lines
below.
The documents on internet still let me confused about what
"getOutputStream()" and "getInputStream()" are doing?
BTW, is it that getOutputStream and getInputStream always have to
appear in a pair? Because I think that getInputStream() in this code
does not have any functioning, so I removed it, but things went wrong
then.
HttpURLConnection con = (HttpURLConnection)url.openConnection();
....
outStream.write(...);
outStream.flush();
outStream.close();
OutputStreamWriter outStream = new OutputStreamWriter(new
BufferedOutputStream(con.getOutputStream()));
....
BufferedReader in = new BufferedReader(new
InputStreamReader(con.getInputStream()));
....
Thanks!
I'm trying to understand somebody's code. I've listed some lines
below.
The documents on internet still let me confused about what
"getOutputStream()" and "getInputStream()" are doing?
BTW, is it that getOutputStream and getInputStream always have to
appear in a pair? Because I think that getInputStream() in this code
does not have any functioning, so I removed it, but things went wrong
then.
HttpURLConnection con = (HttpURLConnection)url.openConnection();
....
outStream.write(...);
outStream.flush();
outStream.close();
OutputStreamWriter outStream = new OutputStreamWriter(new
BufferedOutputStream(con.getOutputStream()));
....
BufferedReader in = new BufferedReader(new
InputStreamReader(con.getInputStream()));
....
Thanks!