protected void copyInputToOutput(InputStream is, OutputStream os, Annotation[] anns, MultivaluedMap<String, Object> outHeaders) throws IOException { if (isRangeSupported()) { Message inMessage = PhaseInterceptorChain.getCurrentMessage().getExchange().getInMessage(); handleRangeRequest(is, os, new HttpHeadersImpl(inMessage), outHeaders); } else { boolean nioWrite = AnnotationUtils.getAnnotation(anns, UseNio.class) != null; if (nioWrite) { ContinuationProvider provider = getContinuationProvider(); if (provider != null) { copyUsingNio(is, os, provider.getContinuation()); } return; } if (closeResponseInputStream) { IOUtils.copyAndCloseInput(is, os, bufferSize); } else { IOUtils.copy(is, os, bufferSize); } } }