diff --git a/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java b/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java index 7cadc04..efbdfef 100644 --- a/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java +++ b/src/fr/devinsy/kiss4web/SimpleServletDispatcher.java @@ -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();