/** * Writes this content to an OutputStream. * * @param output The target OutputStream. * @param bufferSize The buffer size to write data chunks. * @return the total number of bytes written * @throws IOException if an error occurs writing the file. * @since 2.1 */ @Override public long write(final OutputStream output, final int bufferSize) throws IOException { final InputStream input = this.getInputStream(); long count = 0; try { // This read/write code from Apache Commons IO final byte[] buffer = new byte[bufferSize]; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } } finally { input.close(); } return count; } }
/** * Writes this content to an OutputStream. * * @param output The target OutputStream. * @param bufferSize The buffer size to write data chunks. * @return the total number of bytes written * @throws IOException if an error occurs writing the file. * @since 2.1 */ @Override public long write(final OutputStream output, final int bufferSize) throws IOException { final InputStream input = this.getInputStream(); long count = 0; try { // This read/write code from Apache Commons IO final byte[] buffer = new byte[bufferSize]; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } } finally { input.close(); } return count; } }
/** * Writes this content to an OutputStream. * * @param output The target OutputStream. * @param bufferSize The buffer size to write data chunks. * @return the total number of bytes written * @throws IOException if an error occurs writing the file. * @since 2.1 */ @Override public long write(final OutputStream output, final int bufferSize) throws IOException { final InputStream input = this.getInputStream(); long count = 0; try { // This read/write code from Apache Commons IO final byte[] buffer = new byte[bufferSize]; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; } } finally { input.close(); } return count; } }
public long write(final OutputStream output, final int bufferSize) throws IOException final InputStream input = this.getInputStream(); long count = 0; try