Like

                                        int read_cnt = 0;
byte[] byteresp = new byte[1024];
                                        int len  =
responseStream.available();
while(read_cnt < len)
{
int size = len - read_cnt;
int nR = responseStream.read(byteresp, 0, (size>1024?1024:(int)size));
if(nR < 0){
break;
}
read_cnt += nR;
             String resp= new String(byteresp, 0, nR);
Log.i("Data", resp);
resp = null;
}


On Mon, Mar 29, 2010 at 4:25 PM, Dilli <dilliraomca...@gmail.com> wrote:

> In your code you should read the complete data available in the
> responseStream because the stream may don't give complete data at one
> attempt.
> You need to call read method on responseStream  till it ends. ( i.e:
> read bytes size -1)
> i.e read the data till you got end of stream.
> then convert it to String and display
>
> better way is to read block by block and display.
>
> May be this will help you.
>
> Thank you
>
> On Mar 29, 3:43 pm, Anna PS <annapowellsm...@googlemail.com> wrote:
> > Hi all,
> >
> > I'm getting a server response back in ddms, here's my code:
> >
> >                         InputStream responseStream =
> method.getResponseBodyAsStream();
> >                         responseString =
> convertStreamToString(responseStream); // standard
> > function for InputStream > String
> >                         int statusCode = method.getStatusCode();
> >                         method.releaseConnection();
> >                         Log.e("httpPost", "Response string: " +
> responseString + ", code: "
> > + statusCode);
> >
> > But I'm finding that ddms logs only show about the first 50 lines of
> > the response, then cuts everything else off, which isn't very helpful,
> > since it means I can't see any of the useful info. I don't have much
> > control over the content of the response - it's a standard Django
> > debug page, i.e. quite long.
> >
> > Does anyone know how I can get ddms to show the whole thing?
> >
> > Thanks!
>
> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> To unsubscribe from this group, send email to android-developers+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>



-- 
Thank you,
Dilli Rao. M
www.arijasoft.com

-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to