Android 클라이언트가 서버에 요청을 보냅니다.HTTP 응답 본문에서 이미지 파일 가져 오기
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://test.com/test");
HttpResponse response = httpclient.execute(httppost);
다음은 어떻게 응답에서 이미지 (바이너리)를 얻을 수
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Date: Wed, 26 Sep 2012 10:59:35 GMT
Content-Type: multipart/form-data; type="image/jpeg"; boundary="simple_boundary"; start="<image>"; start-info="image/jpeg"
Transfer-Encoding: chunked
2000
--simple_boundary
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-ID: <image>
......JPEG Binary Code Here.....
--simple_boundary
아래와 같이 서버에서 응답을 받았습니다.
InputStream is = response.getEntity().getContent();
(InputStream)에는 경계 및 내용 정보도 들어 있습니다.
--simple_boundary
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-ID: <image>
......JPEG Binary Code Here.....
--simple_boundary
어떻게 순수한 이미지 바이너리 데이터를 얻을 수 있습니까? 그리고 가능합니까 ??
작동하지 않습니다. InputStream에는 바이너리 데이터뿐만 아니라 컨텐츠 정보가 포함되어있다. –