Re: Reading Chunked Stream using HttpClient

2003-12-11 Thread Ortwin Glück


Srinivas Vemula wrote:

 We are able to read the stream with
get.getResponseBodyAsStream(). The stream is image bytes delimited by an 
ascii string "--myboundary", So I guess i just need figure out an easy 
way of  cutting this stream into bytes for every occurence of that 
string.  
Just wrap this InputStream and scan for your boundary. It would 
certainly help if you had included the chunk length in your boundary 
string. But I don't see a problem here.

Odi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Reading Chunked Stream using HttpClient

2003-12-11 Thread Srinivas Vemula
Odi,
   Yes, you are right.
   If we access the URL from broweser, it opens up a file dialog 
box and starts filling in bytes and there is no end to it unless we 
close the window. We are able to read the stream with 
get.getResponseBodyAsStream(). The stream is image bytes delimited by an 
ascii string "--myboundary", So I guess i just need figure out an easy 
way of  cutting this stream into bytes for every occurence of that 
string.  That sounds more of an IO issue. Any ideas?
Thanks for your time and response.

Srini
  

Ortwin Glück wrote:

Srinivas,

I understand that you do not mean HTTP's chunked transfer encoding by 
the term "chunked stream" and "chunked input". I guess you are using a 
Multipart-MIME like content encoding. HttpClient does NOT however deal 
with the content and does not provide any means to parse the contents 
format. You must therefore either parse the response stream by 
yourself or use an existing Multipart-MIME library to decode the 
multipart stream. You may want to have a look at the Commons 
FileUpload code which does exactly that or at Multipart-MIME Email 
handling code which must do a similar thing.

Regards

Odi

Srinivas Vemula wrote:

Hi,
 We have a an application which sends chunked input stream for a 
URL request. We are using HttpClient to get the response. The chunked 
response sent by the application is actually a motion image. The 
motion image is retrieved by the first GET command operation and will 
be send as the sequential data. Therefore, display application should 
display the sequential data with dividing the data into an 
image-unit. In this case, boundary character string "--myboundary" is 
fixed as an index.

   What is the best way of handling this type of response and storing 
each image data in  a byte[] array , and using a new byte[] array 
when we see "--myboundary" in the stream.

   The URL looks like
   http://172.16.101.113/image?speed=20
   and the response headers are
   Content-Type: image/jpeg
Thank you all in advance
srini
 

-
To unsubscribe, e-mail: 
[EMAIL PROTECTED]
For additional commands, e-mail: 
[EMAIL PROTECTED]


--
Srinivas Vemula  +91 40 23547826- Ext 201
Associate Consultant +91 40 23541447 (Fax)
Mensamind+91 98497-42720 (Mobile)
Hyderabad
India
http://www.mensamind.com

DISCLAIMER
The information contained in this e-mail is confidential and intended for the named 
recipient(s) only. If you are not an intended recipient of this email you must not 
copy, distribute or take any further action in reliance on it. You should delete it 
and notify the sender immediately.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Reading Chunked Stream using HttpClient

2003-12-11 Thread Ortwin Glück
Srinivas,

I understand that you do not mean HTTP's chunked transfer encoding by 
the term "chunked stream" and "chunked input". I guess you are using a 
Multipart-MIME like content encoding. HttpClient does NOT however deal 
with the content and does not provide any means to parse the contents 
format. You must therefore either parse the response stream by yourself 
or use an existing Multipart-MIME library to decode the multipart 
stream. You may want to have a look at the Commons FileUpload code which 
does exactly that or at Multipart-MIME Email handling code which must do 
a similar thing.

Regards

Odi

Srinivas Vemula wrote:

Hi,
 We have a an application which sends chunked input stream for a URL 
request. We are using HttpClient to get the response. The chunked 
response sent by the application is actually a motion image. The motion 
image is retrieved by the first GET command operation and will be send 
as the sequential data. Therefore, display application should display 
the sequential data with dividing the data into an image-unit. In this 
case, boundary character string "--myboundary" is fixed as an index.

   What is the best way of handling this type of response and storing 
each image data in  a byte[] array , and using a new byte[] array when 
we see "--myboundary" in the stream.

   The URL looks like
   http://172.16.101.113/image?speed=20
   and the response headers are
   Content-Type: image/jpeg
Thank you all in advance
srini
 

-
To unsubscribe, e-mail: 
[EMAIL PROTECTED]
For additional commands, e-mail: 
[EMAIL PROTECTED]
--
 _
 NOSE applied intelligence ag
 ortwin glück  [www]  http://www.nose.ch
 software engineer [email] [EMAIL PROTECTED]
 hardturmstrasse 171   [pgp key]  0x81CF3416
 8005 zürich   [office]  +41-1-277 57 35
 switzerland   [fax] +41-1-277 57 12
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reading Chunked Stream using HttpClient

2003-12-11 Thread Srinivas Vemula
Hi,
  
   We have a an application which sends chunked input stream for a URL 
request. We are using HttpClient to get the response. The chunked 
response sent by the application is actually a motion image. The motion 
image is retrieved by the first GET command operation and will be send 
as the sequential data. Therefore, display application should display 
the sequential data with dividing the data into an image-unit. In this 
case, boundary character string "--myboundary" is fixed as an index.

   What is the best way of handling this type of response and storing 
each image data in  a byte[] array , and using a new byte[] array when 
we see "--myboundary" in the stream.

   The URL looks like
   http://172.16.101.113/image?speed=20
   and the response headers are
   Content-Type: image/jpeg
Thank you all in advance
srini
  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]