WebService를 사용하여 데이터를 가져오고 있지만 62 개의 9 레코드 만 얻었습니다. 이것이 버퍼 크기의 문제라고 생각합니다. 맞습니까?Inputstream Reader에서 버퍼 크기를 어떻게 바꿀 수 있습니까?
다음 코드를 사용하여 WebService에서 데이터를 가져오고 Webserivce는 php로 개발됩니다.
public JSONObject PostConnectionObject(String strUrl,ArrayList<NameValuePair> alstNameValuePair) {
InputStream mInputStream = null;
try {
//This is the default apacheconnection.
HttpClient mHttpClient = new DefaultHttpClient();
//Pathe of serverside
HttpPost mHttpPost = new HttpPost(strUrl);
if(alstNameValuePair!=null)
{
//post the valur you want to pass.
mHttpPost.setEntity(new UrlEncodedFormEntity(alstNameValuePair));
}
//get the valu from the saerverside as response.
HttpResponse mHttpResponse = mHttpClient.execute(mHttpPost);
HttpEntity mHttpEntity = mHttpResponse.getEntity();
mInputStream = mHttpEntity.getContent();
}
catch (Exception e) {
// TODO Auto-generated catch block
Log.e(strTAG,"Error in HttpClient,HttpPost,HttpResponse,HttpEntity");
}
String strLine = null;
String strResult = null;
//convert response in to the string.
try {
BufferedReader mBufferedReader = new BufferedReader(new InputStreamReader(mInputStream,"iso-8859-1"), 8);
StringBuilder mStringBuilder = new StringBuilder();
while((strLine = mBufferedReader.readLine()) != null) {
mStringBuilder.append(strLine + "\n");
}
mInputStream.close();
strResult = mStringBuilder.toString();
System.out.println("Value of Result :"+strResult);
}
catch (Exception e) {
// TODO Auto-generated catch block
//System.out.println("Error in BufferedReadering");
Log.e(strTAG,"Error in BufferedReadering");
}
위의 예를 보내주십시오. –