Hi

I am trying to do a simple "GET" where i want to hit the URL and retrieve
the Data associated with it.

I am partially successful in doing this. I get the data but its in complete
and i am not able to trace the reason why its so.

Here is my code snippet.

int iVal;char tempBuf[] = new char[10000];StringBuffer
<http://www.google.com/search?hl=en&q=allinurl%3Astringbuffer+java.sun.com&btnI=I%27m%20Feeling%20Lucky>
urlData = new StringBuffer
<http://www.google.com/search?hl=en&q=allinurl%3Astringbuffer+java.sun.com&btnI=I%27m%20Feeling%20Lucky>();BufferedReader
<http://www.google.com/search?hl=en&q=allinurl%3Abufferedreader+java.sun.com&btnI=I%27m%20Feeling%20Lucky>
In=null;
                URL
<http://www.google.com/search?hl=en&q=allinurl%3Aurl+java.sun.com&btnI=I%27m%20Feeling%20Lucky>
url=null;HttpURLConnection
<http://www.google.com/search?hl=en&q=allinurl%3Ahttpurlconnection+java.sun.com&btnI=I%27m%20Feeling%20Lucky>
urlConnection=null;
                try{

   url = new URL
<http://www.google.com/search?hl=en&q=allinurl%3Aurl+java.sun.com&btnI=I%27m%20Feeling%20Lucky>("http://ideone.com/xmADx";);
   urlConnection = (HttpURLConnection
<http://www.google.com/search?hl=en&q=allinurl%3Ahttpurlconnection+java.sun.com&btnI=I%27m%20Feeling%20Lucky>)
url.openConnection();


   In = new BufferedReader
<http://www.google.com/search?hl=en&q=allinurl%3Abufferedreader+java.sun.com&btnI=I%27m%20Feeling%20Lucky>(new
InputStreamReader
<http://www.google.com/search?hl=en&q=allinurl%3Ainputstreamreader+java.sun.com&btnI=I%27m%20Feeling%20Lucky>(urlConnection.getInputStream()));

   while ((iVal = In.read(tempBuf)) != -1){

     urlData.append(tempBuf);
   } }catch(IOException
<http://www.google.com/search?hl=en&q=allinurl%3Aioexception+java.sun.com&btnI=I%27m%20Feeling%20Lucky>
e){}finally{

  try {
     In.close();
     urlConnection.disconnect();
     return urlData.toString();
  }

  catch (IOException
<http://www.google.com/search?hl=en&q=allinurl%3Aioexception+java.sun.com&btnI=I%27m%20Feeling%20Lucky>
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)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to