hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gael Laurans" <glaur...@gmail.com>
Subject Re: getResponseBodyAsStream vs. getResponseBodyAsString
Date Sat, 17 Feb 2007 17:11:35 GMT
This should obviously read InputStreamReader, here is the code snippet

        BufferedReader rdrEditForm =
            new BufferedReader(new InputStreamReader(
                inEditForm,
                wiki.getCharset()));

On 2/17/07, Gael Laurans <glaurans@gmail.com> wrote:
>
> Hello,
>
> Are you completely sure of that ? I just tried this available() thing
> while debugging after figuring out that no text seemed to be read. What I am
> actually doing is feeding the input stream to an
> InputFileReader/BufferedReader and parsing it in a while( reader.ready())
> loop. Is there something wrong with that then ? Note that available() does
> return the size of the page when I am using Wikipedia's server.
>
> Thank you for your help,
> Gaƫl
>
> On 2/17/07, Roland Weber <http-async@dubioso.net> wrote:
> >
> > Hello Gael,
> >
> > > The stream seems to be empty,
> > > mystream.available() returns 0, but getResponseBodyAsString() does
> > return
> > > the content of the page.
> >
> > InputStream.available does NOT tell you how much bytes are in the
> > stream.
> > It tells you how much you can read _without_blocking_. If you call the
> > read() method while available returns 0, it will simply block until some
> > bytes become available or EOF is detected.
> >
> >
> > http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStream.html#available()<http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStream.html#available%28%29>
> >
> > cheers,
> >   Roland
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message