MCPcopy Create free account
hub / github.com/defold/defold / sendFile

Method sendFile

engine/dlib/src/test/http_server/TestHttpServer.java:473–483  ·  view source on GitHub ↗
(String target, HttpServletResponse response)

Source from the content-addressed store, hash-verified

471 }
472
473 private void sendFile(String target, HttpServletResponse response) throws IOException {
474 Reader r = new FileReader(target);
475 char[] buf = new char[1024 * 128];
476 int n = r.read(buf);
477 if (n > 0) {
478 response.getWriter().print(new String(buf, 0, n));
479 }
480 // NOTE: We flush here to force chunked encoding
481 response.getWriter().flush();
482 r.close();
483 }
484
485 private void sendFile(File file, Range range, HttpServletResponse response) throws IOException {
486 long size = range.end - range.start + 1;

Callers 1

handleMethod · 0.95

Calls 5

copyStreamMethod · 0.95
closeMethod · 0.65
readMethod · 0.45
printMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected