/** * Write the data in "source" to the specified stream. * @param out The output stream. * @throws IOException if an IO problem occurs. * @see org.apache.commons.httpclient.methods.multipart.Part#sendData(OutputStream) */ protected void sendData(OutputStream out) throws IOException { LOG.trace("enter sendData(OutputStream out)"); if (lengthOfData() == 0) { // this file contains no data, so there is nothing to send. // we don't want to create a zero length buffer as this will // cause an infinite loop when reading. LOG.debug("No data to send."); return; } byte[] tmp = new byte[4096]; InputStream instream = source.createInputStream(); try { int len; while ((len = instream.read(tmp)) >= 0) { out.write(tmp, 0, len); } } finally { // we're done with the stream, close it instream.close(); } }
/** * Write the data in "source" to the specified stream. * @param out The output stream. * @throws IOException if an IO problem occurs. * @see org.apache.commons.httpclient.methods.multipart.Part#sendData(OutputStream) */ protected void sendData(OutputStream out) throws IOException { LOG.trace("enter sendData(OutputStream out)"); if (lengthOfData() == 0) { // this file contains no data, so there is nothing to send. // we don't want to create a zero length buffer as this will // cause an infinite loop when reading. LOG.debug("No data to send."); return; } byte[] tmp = new byte[4096]; InputStream instream = source.createInputStream(); try { int len; while ((len = instream.read(tmp)) >= 0) { out.write(tmp, 0, len); } } finally { // we're done with the stream, close it instream.close(); } }
/** * Write the data in "source" to the specified stream. * @param out The output stream. * @throws IOException if an IO problem occurs. * @see org.apache.commons.httpclient.methods.multipart.Part#sendData(OutputStream) */ protected void sendData(OutputStream out) throws IOException { LOG.trace("enter sendData(OutputStream out)"); if (lengthOfData() == 0) { // this file contains no data, so there is nothing to send. // we don't want to create a zero length buffer as this will // cause an infinite loop when reading. LOG.debug("No data to send."); return; } byte[] tmp = new byte[4096]; InputStream instream = source.createInputStream(); try { int len; while ((len = instream.read(tmp)) >= 0) { out.write(tmp, 0, len); } } finally { // we're done with the stream, close it instream.close(); } }
/** * Write the data in "source" to the specified stream. * @param out The output stream. * @throws IOException if an IO problem occurs. * @see org.apache.commons.httpclient.methods.multipart.Part#sendData(OutputStream) */ protected void sendData(OutputStream out) throws IOException { LOG.trace("enter sendData(OutputStream out)"); if (lengthOfData() == 0) { // this file contains no data, so there is nothing to send. // we don't want to create a zero length buffer as this will // cause an infinite loop when reading. LOG.debug("No data to send."); return; } byte[] tmp = new byte[4096]; InputStream instream = source.createInputStream(); try { int len; while ((len = instream.read(tmp)) >= 0) { out.write(tmp, 0, len); } } finally { // we're done with the stream, close it instream.close(); } }
/** * Write the data in "source" to the specified stream. * @param out The output stream. * @throws IOException if an IO problem occurs. * @see org.apache.commons.httpclient.methods.multipart.Part#sendData(OutputStream) */ protected void sendData(OutputStream out) throws IOException { LOG.trace("enter sendData(OutputStream out)"); if (lengthOfData() == 0) { // this file contains no data, so there is nothing to send. // we don't want to create a zero length buffer as this will // cause an infinite loop when reading. LOG.debug("No data to send."); return; } byte[] tmp = new byte[4096]; InputStream instream = source.createInputStream(); try { int len; while ((len = instream.read(tmp)) >= 0) { out.write(tmp, 0, len); } } finally { // we're done with the stream, close it instream.close(); } }