< prev index next >
test/jdk/java/nio/channels/FileChannel/directio/ReadDirect.java
Print this page
rev 47447 : 8189775: java/nio/channels/FileChannel/directio/ReadDirect.java failed with NumberFormatException
Summary: Clamp the offset so the scattering read remains within the channel.
Reviewed-by: XXX
rev 47428 : 8164900: Add support for O_DIRECT
Summary: Add support for Direct I/O in FileChannel
Reviewed-by: alanb, bpb, alanbur, coffeys, aph, clanger, plevart, mli, psandoz, simonis
Contributed-by: Lucy Lu <yingqi.lu@intel.com>, Volker Simonis <volker.simonis@gmail.com>
*** 175,185 ****
for (int j = 0; j < charsPerGroup; j++) {
dests[i].put(j, (byte)'a');
}
}
! randomNumber = generator.nextInt(100);
long offset = randomNumber * charsPerGroup;
fc.position(offset);
fc.read(dests, 1, 2);
for (int i = 0; i < 4; i++) {
--- 175,190 ----
for (int j = 0; j < charsPerGroup; j++) {
dests[i].put(j, (byte)'a');
}
}
! // The size of the test FileChannel is 100*charsPerGroup.
! // As the channel bytes will be scattered into two buffers
! // each of size charsPerGroup, the offset cannot be greater
! // than 98*charsPerGroup, so the value of randomNumber must
! // be in the range [0,98], i.e., 0 <= randomNumber < 99.
! randomNumber = generator.nextInt(99);
long offset = randomNumber * charsPerGroup;
fc.position(offset);
fc.read(dests, 1, 2);
for (int i = 0; i < 4; i++) {
< prev index next >