Fix input while.
This commit is contained in:
parent
922b869a7f
commit
2cbfb12b0b
1 changed files with 13 additions and 4 deletions
|
@ -247,13 +247,22 @@ public class SimpleServletDispatcher extends HttpServlet
|
|||
FileInputStream in = null;
|
||||
try // Only for the in.
|
||||
{
|
||||
byte[] buffer = new byte[256*1024];
|
||||
byte[] buffer = new byte[64*1024];
|
||||
|
||||
in = new FileInputStream(file);
|
||||
|
||||
while (in.read(buffer) != -1)
|
||||
boolean ended = false;
|
||||
while (!ended)
|
||||
{
|
||||
out.write(buffer);
|
||||
int count = in.read(buffer);
|
||||
|
||||
if (count == -1)
|
||||
{
|
||||
ended = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
out.write(buffer, 0, count);
|
||||
}
|
||||
}
|
||||
out.flush();
|
||||
out.close();
|
||||
|
|
Loading…
Reference in a new issue