public void writeRequest(final OutputStream out) throws IOException {
//byte[] tmp = new byte[4096];
ByteBuffer tmp = ByteBuffer.allocate(4096);
public void writeRequest(final OutputStream out) throws IOException {
//byte[] tmp = new byte[4096];
ByteBuffer tmp = ByteBuffer.allocate(4096);
// TODO(bprzybylski): each mem allocation can throw OutOfMemoryError we need to handle it
// globally in some fashionable manner
// TODO(bprzybylski): each mem allocation can throw OutOfMemoryError we need to handle it
// globally in some fashionable manner
FileChannel channel = raf.getChannel();
FileLock lock = channel.tryLock();
Iterator<OnDatatransferProgressListener> it = null;
FileChannel channel = raf.getChannel();
FileLock lock = channel.tryLock();
Iterator<OnDatatransferProgressListener> it = null;
- while ((i = channel.read(tmp)) >= 0) {
- out.write(tmp.array(), 0, i);
+ while ((readResult = channel.read(tmp)) >= 0) {
+ out.write(tmp.array(), 0, readResult);