public void test_oneTrial_readAll_writeAll() throws IOException {
  final File file=File.createTempFile("TestFileChannelUtility",getName());
  file.deleteOnExit();
  final RandomAccessFile raf=new RandomAccessFile(file,"rw");
  try {
    final byte[] expected=new byte[FILE_SIZE];
{
      r.nextBytes(expected);
    }
    final int ioCount1=FileChannelUtility.writeAll(raf.getChannel(),ByteBuffer.wrap(expected),0L);
    final byte[] actual=new byte[expected.length];
    final int ioCount2=FileChannelUtility.readAll(raf.getChannel(),ByteBuffer.wrap(actual),0L);
    assertSameData(expected,actual);
  }
  finally {
    try {
      raf.close();
    }
 catch (    Throwable t) {
      t.printStackTrace();
    }
    file.delete();
  }
}

public void test_oneTrial_readAll_writeAll ( ) throws IOException { final File file = File . createTempFile ( "TestFileChannelUtility" , getName ( ) ) ; file . deleteOnExit ( ) ; final RandomAccessFile raf = new RandomAccessFile ( file , "rw" ) ; try { final byte [ ] expected = new byte [ FILE_SIZE ] ; { r . nextBytes ( expected ) ; } final int ioCount1 = FileChannelUtility . writeAll ( raf . getChannel ( ) , ByteBuffer . wrap ( expected ) , 0L ) ; final byte [ ] actual = new byte [ expected . length ] ; final int ioCount2 = FileChannelUtility . readAll ( raf . getChannel ( ) , ByteBuffer . wrap ( actual ) , 0L ) ; assertSameData ( expected , actual ) ; } finally { try { raf . close ( ) ; } catch ( Throwable t ) { t . printStackTrace ( ) ; } file . delete ( ) ; } }
a single trial testing the behavior of readall ( ) and writeall ( )
