int iVal;
char tempBuf[] = new char[10000];
StringBuffer urlData = new StringBuffer();
BufferedReader In=null;
URL url=null;
HttpURLConnection urlConnection=null;
try{
url = new URL("http://ideone.com/xmADx");
urlConnection = (HttpURLConnection) url.openConnection();
In = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
while ((iVal = In.read(tempBuf)) != -1){
urlData.append(tempBuf);
}
}
catch(IOException e){}
finally{
try {
In.close();
urlConnection.disconnect();
return urlData.toString();
}
catch (IOException e){}}
return null;
Can someone guide me why this is happening. the data i get in return is ending like "<html> <script..." (just an example)
I sometimes observed that it can write to the File properly but writes incomplete in the buffer.