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;
|
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();
|
||||||
|
|
Loading…
Reference in a new issue