DataOutputStream dos = new DataOutputStream( new BufferedOutputStream(
new FileOutputStream(new
FileC temp, tmp"))));
for(int i = 0; i < numOflnts; i++) dos writelnt(i); dos.closeO;
}
}.
new Tester("Mapped Write") {
public void testO throws IOException { FileChannel fc =
new RandomAccessFile("temp.tmp". "rw") getChannel(); IntBuffer ib = fc map(
FileChannel .MapMode READ_WRITE, 0. fc sizeO) .asIntBufferO; for(int i = 0; i < numOflnts; i++)
ib.putCi); fc.closeO;
}
}.
new Tester("Stream Read") {
public void testO throws IOException {
DatalnputStream dis = new DatalnputStreamC new BufferedlnputStreamC
new F i1eInputSt rearn("temp.tmp"))); for(int i = 0; i < numOflnts; i++)
dis.readlntO; dis.closeO;
}
}.
new Tester("Mapped Read") {
public void testO throws IOException {
FileChannel fc = new FileInputStream(
new File("temp.tmp")).getChannelО; IntBuffer ib = fc.map(
Fi 1 eChannel.MapMode.READ_0NLY, 0. fc.sizeO) .asIntBufferO; while(ib. hasRemainingO)
ib.getO; fc. closeO;
}
}.
new Tester("Stream Read/Write") {
public void testO throws IOException {