Fix input while.

This commit is contained in:
Christian P. MOMON 2010-08-12 01:07:50 +02:00
parent 922b869a7f
commit 2cbfb12b0b

View file

@ -247,13 +247,22 @@ public class SimpleServletDispatcher extends HttpServlet
FileInputStream in = null; FileInputStream in = null;
try // Only for the in. try // Only for the in.
{ {
byte[] buffer = new byte[256*1024]; byte[] buffer = new byte[64*1024];
in = new FileInputStream(file); in = new FileInputStream(file);
boolean ended = false;
while (in.read(buffer) != -1) while (!ended)
{ {
out.write(buffer); int count = in.read(buffer);
if (count == -1)
{
ended = true;
}
else
{
out.write(buffer, 0, count);
}
} }
out.flush(); out.flush();
out.close(); out.close();