@Override public int write(ByteBuffer src) throws IOException { checkNotNull(src); checkOpenConnected(); if (!src.hasRemaining()) { return 0; } int writeCount = writeImpl(src); if (writeCount > 0) { src.position(src.position() + writeCount); } return writeCount; }
@Override public int read(ByteBuffer target) throws IOException { target.checkWritable(); checkOpenConnected(); if (!target.hasRemaining()) { return 0; } int readCount = 0; if (target.isDirect() || target.hasArray()) { readCount = readImpl(target); if (readCount > 0) { target.position(target.position() + readCount); } } else { byte[] readArray = new byte[target.remaining()]; ByteBuffer readBuffer = ByteBuffer.wrap(readArray); readCount = readImpl(readBuffer); if (readCount > 0) { target.put(readArray, 0, readCount); } } return readCount; }
@Override public long read(ByteBuffer[] targets, int offset, int length) throws IOException { Arrays.checkOffsetAndCount(targets.length, offset, length); // status must be open and connected checkOpenConnected(); int totalCount = FileChannelImpl.calculateTotalRemaining(targets, offset, length, true); if (totalCount == 0) { return 0; } // read data to readBuffer, and then transfer data from readBuffer to // targets. ByteBuffer readBuffer = ByteBuffer.allocate(totalCount); int readCount; readCount = readImpl(readBuffer); int left = readCount; int index = offset; // transfer data from readBuffer to targets byte[] readArray = readBuffer.array(); while (left > 0) { int putLength = Math.min(targets[index].remaining(), left); targets[index].put(readArray, readCount - left, putLength); index++; left -= putLength; } return readCount; }
checkOpenConnected(); int count = FileChannelImpl.calculateTotalRemaining(sources, offset, length, false); if (count == 0) {
@Override public int write(ByteBuffer src) throws IOException { checkNotNull(src); checkOpenConnected(); if (!src.hasRemaining()) { return 0; } int writeCount = writeImpl(src); if (writeCount > 0) { src.position(src.position() + writeCount); } return writeCount; }
@Override public int write(ByteBuffer src) throws IOException { checkNotNull(src); checkOpenConnected(); if (!src.hasRemaining()) { return 0; } int writeCount = writeImpl(src); if (writeCount > 0) { src.position(src.position() + writeCount); } return writeCount; }
@Override public int write(ByteBuffer src) throws IOException { checkNotNull(src); checkOpenConnected(); if (!src.hasRemaining()) { return 0; } int writeCount = writeImpl(src); if (writeCount > 0) { src.position(src.position() + writeCount); } return writeCount; }
@Override public int write(ByteBuffer src) throws IOException { checkNotNull(src); checkOpenConnected(); if (!src.hasRemaining()) { return 0; } int writeCount = writeImpl(src); if (writeCount > 0) { src.position(src.position() + writeCount); } return writeCount; }
@Override public int write(ByteBuffer src) throws IOException { checkNotNull(src); checkOpenConnected(); if (!src.hasRemaining()) { return 0; } int writeCount = writeImpl(src); if (writeCount > 0) { src.position(src.position() + writeCount); } return writeCount; }
@Override public int write(ByteBuffer src) throws IOException { checkNotNull(src); checkOpenConnected(); if (!src.hasRemaining()) { return 0; } int writeCount = writeImpl(src); if (writeCount > 0) { src.position(src.position() + writeCount); } return writeCount; }
@Override public int read(ByteBuffer target) throws IOException { target.checkWritable(); checkOpenConnected(); if (!target.hasRemaining()) { return 0; } int readCount = 0; if (target.isDirect() || target.hasArray()) { readCount = readImpl(target); if (readCount > 0) { target.position(target.position() + readCount); } } else { byte[] readArray = new byte[target.remaining()]; ByteBuffer readBuffer = ByteBuffer.wrap(readArray); readCount = readImpl(readBuffer); if (readCount > 0) { target.put(readArray, 0, readCount); } } return readCount; }
@Override public int read(ByteBuffer target) throws IOException { target.checkWritable(); checkOpenConnected(); if (!target.hasRemaining()) { return 0; } int readCount = 0; if (target.isDirect() || target.hasArray()) { readCount = readImpl(target); if (readCount > 0) { target.position(target.position() + readCount); } } else { byte[] readArray = new byte[target.remaining()]; ByteBuffer readBuffer = ByteBuffer.wrap(readArray); readCount = readImpl(readBuffer); if (readCount > 0) { target.put(readArray, 0, readCount); } } return readCount; }
@Override public int read(ByteBuffer target) throws IOException { target.checkWritable(); checkOpenConnected(); if (!target.hasRemaining()) { return 0; } int readCount = 0; if (target.isDirect() || target.hasArray()) { readCount = readImpl(target); if (readCount > 0) { target.position(target.position() + readCount); } } else { byte[] readArray = new byte[target.remaining()]; ByteBuffer readBuffer = ByteBuffer.wrap(readArray); readCount = readImpl(readBuffer); if (readCount > 0) { target.put(readArray, 0, readCount); } } return readCount; }
@Override public int read(ByteBuffer target) throws IOException { target.checkWritable(); checkOpenConnected(); if (!target.hasRemaining()) { return 0; } int readCount = 0; if (target.isDirect() || target.hasArray()) { readCount = readImpl(target); if (readCount > 0) { target.position(target.position() + readCount); } } else { byte[] readArray = new byte[target.remaining()]; ByteBuffer readBuffer = ByteBuffer.wrap(readArray); readCount = readImpl(readBuffer); if (readCount > 0) { target.put(readArray, 0, readCount); } } return readCount; }
@Override public int read(ByteBuffer target) throws IOException { target.checkWritable(); checkOpenConnected(); if (!target.hasRemaining()) { return 0; } int readCount = 0; if (target.isDirect() || target.hasArray()) { readCount = readImpl(target); if (readCount > 0) { target.position(target.position() + readCount); } } else { byte[] readArray = new byte[target.remaining()]; ByteBuffer readBuffer = ByteBuffer.wrap(readArray); readCount = readImpl(readBuffer); if (readCount > 0) { target.put(readArray, 0, readCount); } } return readCount; }
@Override public int read(ByteBuffer target) throws IOException { target.checkWritable(); checkOpenConnected(); if (!target.hasRemaining()) { return 0; } int readCount = 0; if (target.isDirect() || target.hasArray()) { readCount = readImpl(target); if (readCount > 0) { target.position(target.position() + readCount); } } else { byte[] readArray = new byte[target.remaining()]; ByteBuffer readBuffer = ByteBuffer.wrap(readArray); readCount = readImpl(readBuffer); if (readCount > 0) { target.put(readArray, 0, readCount); } } return readCount; }
@Override public long read(ByteBuffer[] targets, int offset, int length) throws IOException { Arrays.checkOffsetAndCount(targets.length, offset, length); // status must be open and connected checkOpenConnected(); int totalCount = FileChannelImpl.calculateTotalRemaining(targets, offset, length, true); if (totalCount == 0) { return 0; } // read data to readBuffer, and then transfer data from readBuffer to // targets. ByteBuffer readBuffer = ByteBuffer.allocate(totalCount); int readCount; readCount = readImpl(readBuffer); int left = readCount; int index = offset; // transfer data from readBuffer to targets byte[] readArray = readBuffer.array(); while (left > 0) { int putLength = Math.min(targets[index].remaining(), left); targets[index].put(readArray, readCount - left, putLength); index++; left -= putLength; } return readCount; }
@Override public long read(ByteBuffer[] targets, int offset, int length) throws IOException { Arrays.checkOffsetAndCount(targets.length, offset, length); // status must be open and connected checkOpenConnected(); int totalCount = FileChannelImpl.calculateTotalRemaining(targets, offset, length, true); if (totalCount == 0) { return 0; } // read data to readBuffer, and then transfer data from readBuffer to // targets. ByteBuffer readBuffer = ByteBuffer.allocate(totalCount); int readCount; readCount = readImpl(readBuffer); int left = readCount; int index = offset; // transfer data from readBuffer to targets byte[] readArray = readBuffer.array(); while (left > 0) { int putLength = Math.min(targets[index].remaining(), left); targets[index].put(readArray, readCount - left, putLength); index++; left -= putLength; } return readCount; }
@Override public long read(ByteBuffer[] targets, int offset, int length) throws IOException { Arrays.checkOffsetAndCount(targets.length, offset, length); // status must be open and connected checkOpenConnected(); int totalCount = FileChannelImpl.calculateTotalRemaining(targets, offset, length, true); if (totalCount == 0) { return 0; } // read data to readBuffer, and then transfer data from readBuffer to // targets. ByteBuffer readBuffer = ByteBuffer.allocate(totalCount); int readCount; readCount = readImpl(readBuffer); int left = readCount; int index = offset; // transfer data from readBuffer to targets byte[] readArray = readBuffer.array(); while (left > 0) { int putLength = Math.min(targets[index].remaining(), left); targets[index].put(readArray, readCount - left, putLength); index++; left -= putLength; } return readCount; }
@Override public long read(ByteBuffer[] targets, int offset, int length) throws IOException { Arrays.checkOffsetAndCount(targets.length, offset, length); // status must be open and connected checkOpenConnected(); int totalCount = FileChannelImpl.calculateTotalRemaining(targets, offset, length, true); if (totalCount == 0) { return 0; } // read data to readBuffer, and then transfer data from readBuffer to // targets. ByteBuffer readBuffer = ByteBuffer.allocate(totalCount); int readCount; readCount = readImpl(readBuffer); int left = readCount; int index = offset; // transfer data from readBuffer to targets byte[] readArray = readBuffer.array(); while (left > 0) { int putLength = Math.min(targets[index].remaining(), left); targets[index].put(readArray, readCount - left, putLength); index++; left -= putLength; } return readCount; }