> Hi,
> I use BufferedReader to read the HTTP message sent to the proxy from
[quoted text clipped - 4 lines]
> I understand that its because it has not been sent to the browser in
> the right format . But how can i do that?
I'm assuming you use writeLine(), println() or something equivalent (you
should have specified what you're using to write). These methods do line
ending conversion. That is, if your proxy receives "\r" because, it might
write out "\n\r", thus changing the content of the data.
Instead, you should read the data into an array of bytes so that no
line-ending conversion occurs. See the read(char[], int, int) method in
BufferedReader, and its equivalent in whatever you're using to write.
- Oliver
pvsnmp@yahoo.com - 08 Sep 2005 22:30 GMT
Hi,
thanks for the info , I am using println( )
I will try the way you suggested, but how do i set the size of the
character array?
Also, I have been reading that data such as images must be read using
byte streams and not character streams. And if i have to use bytestream
how big should be the byte array that has to be created?
thanks and rgds,
Prashant
Oliver Wong - 08 Sep 2005 22:32 GMT
> Hi,
> thanks for the info , I am using println( )
> I will try the way you suggested, but how do i set the size of the
> character array?
char[] myCharacterArray = new char[THE_DESIRED_SIZE];
> Also, I have been reading that data such as images must be read using
> byte streams and not character streams. And if i have to use bytestream
> how big should be the byte array that has to be created?
I don't know of any good rule for this. I think 256 and 1024 are popular
sizes.
- Oliver
pvsnmp@yahoo.com - 08 Sep 2005 23:04 GMT
Hi,
>char[] myCharacterArray = new char[THE_DESIRED_SIZE];
I know this , but i am wondering about what should be the value of
THE_DESIRED_SIZE ?
Anyway thanks,
I found a posting of a problem which I think I am encountering as well
titled 'Using Reader and Stream classes on same Input'
http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/ab
a23d1bdf28b48d/9ad85c870e71d08c?q=BufferedInputStream&rnum=88#9ad85c870e71d08c
rgds,
Prashant
>I use BufferedReader to read the HTTP message sent to the proxy from
>the server. So I use the readLine() method and then write every line to
[quoted text clipped - 3 lines]
>I understand that its because it has not been sent to the browser in
>the right format . But how can i do that?
Images are binary. They are not lines of text. See
http://mindprod.com/applets/fileio.html
for how to read binary as opposed to character data.
Think of an image as an octet-stream, 8-bit bytes read raw with no
translation of any kind. BufferedReaders convert 8-bit streams to
16-bit characters. They are designed for human-readable data.
See http://mindprod.com/jgloss/urlconnection.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.