if (this.buffer.hasData()) { dst.position(position); bytesRead = this.buffer.read(dst); } else { if (this.channel.isOpen()) {
final int len = this.buffer.read(dst, maxLen); if (len > 0) { this.pos += len;
if (this.buffer.hasData()) { dst.position(position); bytesRead = this.buffer.read(dst); } else { if (this.channel.isOpen()) {
final int len = this.buffer.read(dst, maxLen); if (len > 0) { this.pos += len;
@Override public int read(final ByteBuffer dst) throws IOException { Args.notNull(dst, "Byte buffer"); if (this.completed) { return -1; } final int bytesRead; if (this.buffer.hasData()) { bytesRead = this.buffer.read(dst); } else { bytesRead = readFromChannel(dst); } if (bytesRead == -1) { this.completed = true; } return bytesRead; }
final int maxLen = Math.min(chunk, this.buffer.length()); dst.position(position); bytesRead = this.buffer.read(dst, maxLen); } else { if (this.channel.isOpen()) {
final int maxLen = Math.min(chunk, this.buffer.length()); dst.position(position); bytesRead = this.buffer.read(dst, maxLen); } else { if (this.channel.isOpen()) {
@Override public int read(final ByteBuffer dst) throws IOException { Args.notNull(dst, "Byte buffer"); if (this.completed) { return -1; } final int bytesRead; if (this.buffer.hasData()) { bytesRead = this.buffer.read(dst); } else { bytesRead = readFromChannel(dst); } if (bytesRead == -1) { this.completed = true; } return bytesRead; }
if (this.buffer.hasData()) { final int maxLen = Math.min(chunk, this.buffer.length()); bytesRead = this.buffer.read(dst, maxLen); } else { bytesRead = readFromChannel(dst, chunk);
if (this.buffer.hasData()) { final int maxLen = Math.min(chunk, this.buffer.length()); bytesRead = this.buffer.read(dst, maxLen); } else { bytesRead = readFromChannel(dst, chunk);