xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Clark <an...@apache.org>
Subject Re: Reading XML from a Socket (WrappedInputStream)
Date Thu, 21 Dec 2000 04:58:32 GMT
Ahmad Morad wrote:
> In my code i read XML Data from the InputStream of a socket. But 
> in some cases, i read also standard text data from the socket. So 
> i need a method, which reads the complete message from the stream 
> and returns the result as a string. I use the following code in 
> my application:

You don't have enough code in your post for me to accurately
deduce your problem. However, there are a few things I can

First, are you calling the WrappedOutputStream#close method
on the output? Also, perhaps the following code should be
changed from this:

      while ((count = wf.read(fBuffer,0, length)) > 0)

to this:

      while ((count = wf.read(fBuffer,0, length)) != -1)

Lastly, perhaps there's a bug in my sample code. Although,
I didn't see problems like this before.

Andy Clark * IBM, TRL - Japan * andyc@apache.org

View raw message