@Override public int read( ByteBuffer dst ) throws IOException { return delegate.read( dst ); }
@Override public long read( ByteBuffer[] byteBuffers, int i, int i1 ) throws IOException { return inner.read( byteBuffers, i, i1 ); }
@Override public long read( ByteBuffer[] dsts, int offset, int length ) throws IOException { return delegate.read( dsts, offset, length ); }
@Override public long read( ByteBuffer[] dsts ) throws IOException { return delegate.read( dsts ); }
@Override public int read( ByteBuffer dst ) throws IOException { return delegate.read( dst ); }
@Override public long read( ByteBuffer[] dsts ) throws IOException { return delegate.read( dsts ); }
@Override public long read( ByteBuffer[] dsts, int offset, int length ) throws IOException { return advance( delegateChannel.read( dsts, offset, length ) ); }
@Override public long read( ByteBuffer[] dsts, int offset, int length ) throws IOException { return delegate.read( dsts, offset, length ); }
@Override public int read( ByteBuffer dst, long position ) throws IOException { return delegate.read( dst, position ); }
@Override public int read( ByteBuffer dst, long position ) throws IOException { if ( adversary.injectFailureOrMischief( IOException.class ) ) { int oldLimit = mischiefLimit( dst ); int read = delegate.read( dst, position ); dst.limit( oldLimit ); return read; } return delegate.read( dst, position ); }
@Override public long read( ByteBuffer[] dsts, int offset, int length ) throws IOException { if ( adversary.injectFailureOrMischief( IOException.class ) ) { ByteBuffer lastBuf = dsts[dsts.length - 1]; int oldLimit = mischiefLimit( lastBuf ); long read = delegate.read( dsts, offset, length ); lastBuf.limit( oldLimit ); return read; } return delegate.read( dsts, offset, length ); }
@Override public long read( ByteBuffer[] dsts ) throws IOException { if ( adversary.injectFailureOrMischief( IOException.class ) ) { ByteBuffer lastBuf = dsts[dsts.length - 1]; int oldLimit = mischiefLimit( lastBuf ); long read = delegate.read( dsts ); lastBuf.limit( oldLimit ); return read; } return delegate.read( dsts ); }
@Test void read() throws Exception { channel.read( buf ); verify( actual ).read( buf ); }
@Test( expected = ClosedByInterruptException.class ) public void ch_read_ByteBuffers() throws IOException { chan( true ).read( new ByteBuffer[]{ByteBuffer.allocate( 1 )} ); } }
@Test( expected = ClosedByInterruptException.class ) public void ch_read_ByteBuffer() throws IOException { chan( true ).read( ByteBuffer.allocate( 1 ) ); }
@Test( expected = ClosedByInterruptException.class ) public void ch_read_ByteBuffers_offset_length() throws IOException { chan( true ).read( new ByteBuffer[]{ByteBuffer.allocate( 1 )}, 0, 1 ); }
@Test void readWithPosition() throws Exception { long position = 500; channel.read( buf, position ); verify( actual ).read( buf, position + offset ); }
@Test void readMultiple() throws Exception { channel.read( buffers ); verify( actual ).read( buffers ); }
@Test void readMultipleExtended() throws Exception { int off = 16; int len = 32; channel.read( buffers, off, len ); verify( actual ).read( buffers, off, len ); }