BufferedOutputStream do not write all byte array in linked OutputStream

Hello,

I am writing a proxy.When a proxy works like transparent

"clientOut.write(response, 0, responseLength);"

clientOut is

"BufferedOutputStream clientOut = new BufferedOutputStream(pSocket.getOutputStream());"

All is works right,but when I change response array

"responseProxy = modi_content(response,word,color);"

"modi_content" is a function, who change original response.

After that, I want to write modified response in client stream

"clientOut.write(responseProxy, 0, responseProxy.length);".

The result is that, not all bytes from responseProxy are wrote in OutputStream and

the web page have no all source code and desplays incorrect in browser.

Do you have any ideas, where I make mistake and who is that mistake.

Thank you.

[821 byte] By [dani_b_angelova] at [2007-11-27 4:23:49]
# 1
Did you close or flush the stream?
-Kayaman-a at 2007-7-12 9:31:29 > top of Java-index,Java Essentials,Java Programming...
# 2
> Did you close or flush the stream?Also, make sure you close/flush the BufferedOutputStream and not the OutputStream that it wraps.
sabre150a at 2007-7-12 9:31:29 > top of Java-index,Java Essentials,Java Programming...
# 3
Did you put all the data you thought you put into 'responseProxy'? Did you use all the data available in 'response'? Was that the complete response?So many questions, so little time.
ejpa at 2007-7-12 9:31:29 > top of Java-index,Java Essentials,Java Programming...
# 4
when type"System.out.println(new String(responseProxy));"all data is good,but after "clientOut.write(responseProxy, 0, responseProxy.length);"browser dislay not all page.Function "modi_content" just insert a javascript in response.
dani_b_angelova at 2007-7-12 9:31:29 > top of Java-index,Java Essentials,Java Programming...
# 5
Yes,clientOut.close();clientIn.close();
dani_b_angelova at 2007-7-12 9:31:29 > top of Java-index,Java Essentials,Java Programming...
# 6
I found a problem,it is logical.I change the content, that is good ,but I do not change "Content-Length:" in the HeaderThanks for replies
dani_b_angelova at 2007-7-12 9:31:29 > top of Java-index,Java Essentials,Java Programming...