@Override
public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException, NotFoundException {
InputStream in = null;
try {
in = contentService.getFileContent(file);
if (range != null) {
log.debug("sendContent: ranged content: " + file.getAbsolutePath());
RangeUtils.writeRange(in, range, out);
} else {
log.debug("sendContent: send whole file " + file.getAbsolutePath());
IOUtils.copy(in, out);
}
out.flush();
} catch (FileNotFoundException e) {
throw new NotFoundException("Couldnt locate content");
} catch (ReadingException e) {
throw new IOException(e);
} catch (WritingException e) {
throw new IOException(e);
} finally {
IOUtils.closeQuietly(in);
}
}