public long transferTo(final long position, final long count, final FileChannel target) throws IOException { final StreamSourceChannel channel = this.channel; if (channel == null) { return 0; } return channel.transferTo(position, count, target); }
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException { final StreamSourceChannel channel = this.channel; if (channel == null) { return -1L; } return channel.transferTo(count, throughBuffer, target); }
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException { return source.transferTo(count, throughBuffer, target); }
public long transferTo(final long position, final long count, final FileChannel target) throws IOException { return source.transferTo(position, count, target); }
public long transferTo(final long position, final long count, final FileChannel target) throws IOException { return channel.transferTo(position, count, target); }
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException { return channel.transferTo(count, throughBuffer, target); }
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException { return delegate.transferTo(count, throughBuffer, target); }
public long transferTo(final long position, final long count, final FileChannel target) throws IOException { return delegate.transferTo(position, count, target); }
public long transferFrom(final ReadableByteChannel src, final long position, final long count) throws IOException { if (src instanceof StreamSourceChannel) { return ((StreamSourceChannel) src).transferTo(position, count, delegate); } else { return delegate.transferFrom(src, position, count); } }
public long transferTo(final long position, final long count, final FileChannel target) throws IOException { if (isFinished()) { return -1; } return delegate.transferTo(position, count, target); }
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException { if (isFinished()) { return -1; } return delegate.transferTo(count, throughBuffer, target); }
@Override public long transferTo(long position, long count, FileChannel target) throws IOException { return channel.transferTo(position, count, new ChannelFunctionFileChannel(target, functions)); }
/** * Transfer bytes between two channels efficiently, blocking if necessary. * * @param destination the destination file channel * @param source the source channel * @param startPosition the start position in the destination file * @param count the number of bytes to transfer * @throws IOException if an I/O error occurs */ public static void transferBlocking(FileChannel destination, StreamSourceChannel source, long startPosition, final long count) throws IOException { long remaining = count; long res; while (remaining > 0L) { while ((res = source.transferTo(startPosition, remaining, destination)) == 0L) { try { source.awaitReadable(); } catch (InterruptedIOException e) { final long bytes = count - remaining; if (bytes > (long) Integer.MAX_VALUE) { e.bytesTransferred = -1; } else { e.bytesTransferred = (int) bytes; } } } remaining -= res; startPosition += res; } }
if (NULL_FILE_CHANNEL != null) { while (count > 0) { if ((lres = channel.transferTo(0, count, NULL_FILE_CHANNEL)) == 0L) { break;
public long transferTo(final long position, final long count, final FileChannel target) throws IOException { final long remaining = this.remaining; if (anyAreSet(state, FLAG_CLOSED | FLAG_FINISHED) || remaining == 0L || count == 0L) { return 0L; } long res = 0L; try { return res = delegate.transferTo(position, min(count, remaining), target); } finally { if (res > 0L) { if ((this.remaining = remaining - res) == 0L) { state |= FLAG_FINISHED; callFinish(); } } } }
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException { final long remaining = this.remaining; if (anyAreSet(state, FLAG_CLOSED | FLAG_FINISHED) || remaining == 0L) { return -1L; } if (count == 0L) { return 0L; } long res = 0L; try { return res = delegate.transferTo(min(count, remaining), throughBuffer, target); } finally { if (res > 0L) { if ((this.remaining = remaining - res) == 0L) { state |= FLAG_FINISHED; callFinish(); } } } }
cnt = 0L; return cnt + next.transferTo(position, count, target);
cnt = 0L; final long res = next.transferTo(count - cnt, throughBuffer, target); return res > 0L ? cnt + res : cnt > 0L ? cnt : res;
while (t < count) { try { while ((res = source.transferTo(count, throughBuffer, destination)) == 0L) { if (throughBuffer.hasRemaining()) { writeBlocking(destination, throughBuffer);
lres = source.transferTo(count, buffer, sink); } catch (IOException e) { readFailed(e); lres = source.transferTo(count, buffer, sink); } catch (IOException e) { readFailed(e);