프로그래밍/Android
[Android] HttpURLConnection
DwEnn
2017. 9. 28. 20:12
728x90
반응형
안드로이드 개발 문서
기본 검색 폼
URL url = new URL("http://www.android.com/");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try{
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
readStream(in);
}finally{
urlConnection.disconnect();
}
+ 많은 양의 데이터를 서버와 주고 받을 때 스트림을 사용하여 한 번에 많은 데이터가 메모리에 존재 하지 않도록 제한해야 한다
단일 바이트 배열 또는 문자열로 저장하는 대신 스트림으로 처리하는게 좋다
반응형