/** * Copy the contents of the specified input stream to the specified * output stream, and ensure that both streams are closed before returning * (even in the face of an exception).<p> * * @param item the RepositoryItem * @param ostream the output stream to write to * @param range the range the client wants to retrieve * * @throws IOException if an input/output error occurs */ protected void copy(I_CmsRepositoryItem item, ServletOutputStream ostream, CmsWebdavRange range) throws IOException { IOException exception = null; InputStream resourceInputStream = new ByteArrayInputStream(item.getContent()); InputStream istream = new BufferedInputStream(resourceInputStream, m_input); exception = copyRange(istream, ostream, range.getStart(), range.getEnd()); // Clean up the input stream try { istream.close(); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_INPUT_STREAM_0), e); } } // Rethrow any exception that has occurred if (exception != null) { throw exception; } }
exception = copyRange(reader, writer);
/** * Copy the contents of the specified input stream to the specified * output stream, and ensure that both streams are closed before returning * (even in the face of an exception).<p> * * @param item the RepositoryItem * @param writer the writer to write to * @param range the range the client wants to retrieve * * @throws IOException if an input/output error occurs */ protected void copy(I_CmsRepositoryItem item, PrintWriter writer, CmsWebdavRange range) throws IOException { IOException exception = null; InputStream resourceInputStream = new ByteArrayInputStream(item.getContent()); Reader reader = new InputStreamReader(resourceInputStream); exception = copyRange(reader, writer, range.getStart(), range.getEnd()); // Clean up the input stream try { reader.close(); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_READER_0), e); } } // Rethrow any exception that has occurred if (exception != null) { throw exception; } }
/** * Copy the contents of the specified input stream to the specified * output stream, and ensure that both streams are closed before returning * (even in the face of an exception).<p> * * @param item the RepositoryItem * @param writer the writer to write to * @param range the range the client wants to retrieve * * @throws IOException if an input/output error occurs */ protected void copy(I_CmsRepositoryItem item, PrintWriter writer, CmsWebdavRange range) throws IOException { IOException exception = null; InputStream resourceInputStream = new ByteArrayInputStream(item.getContent()); Reader reader = new InputStreamReader(resourceInputStream); exception = copyRange(reader, writer, range.getStart(), range.getEnd()); // Clean up the input stream try { reader.close(); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_READER_0), e); } } // Rethrow any exception that has occurred if (exception != null) { throw exception; } }
exception = copyRange(reader, writer);
exception = copyRange(istream, ostream);
exception = copyRange(istream, ostream, currentRange.getStart(), currentRange.getEnd());
/** * Copy the contents of the specified input stream to the specified * output stream, and ensure that both streams are closed before returning * (even in the face of an exception).<p> * * @param item the RepositoryItem * @param ostream the output stream to write to * @param range the range the client wants to retrieve * * @throws IOException if an input/output error occurs */ protected void copy(I_CmsRepositoryItem item, ServletOutputStream ostream, CmsWebdavRange range) throws IOException { IOException exception = null; InputStream resourceInputStream = new ByteArrayInputStream(item.getContent()); InputStream istream = new BufferedInputStream(resourceInputStream, m_input); exception = copyRange(istream, ostream, range.getStart(), range.getEnd()); // Clean up the input stream try { istream.close(); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_INPUT_STREAM_0), e); } } // Rethrow any exception that has occurred if (exception != null) { throw exception; } }
exception = copyRange(istream, ostream);
exception = copyRange(reader, writer, currentRange.getStart(), currentRange.getEnd());
exception = copyRange(istream, ostream, currentRange.getStart(), currentRange.getEnd());
exception = copyRange(reader, writer, currentRange.getStart(), currentRange.getEnd());