Code example for URLConnection

Methods: getOutputStream

0
	private void writeToServer(URLConnection httpConn, String param
			) throws IOException { 
		// TODO Auto-generated method stub 
		 
		OutputStreamWriter writer = new OutputStreamWriter(
				httpConn.getOutputStream());
		writer.write(param);
		writer.close();
	} 
 
	private String readFromServer(URLConnection httpConn) throws IOException {
		// TODO Auto-generated method stub 
		String response = "";
		BufferedReader br = new BufferedReader(new InputStreamReader(
				httpConn.getInputStream()));
		String temp;
		while ((temp = br.readLine()) != null)
			response += temp;
		br.close();
		return response;
	}