}
private void speedTestStream(int bufferSize) throws IOException {
final Channel.ID tmpChannel = ioManager.createChannel();
final IntegerRecord rec = new IntegerRecord(0);
File tempFile = null;
DataOutputStream daos = null;
DataInputStream dais = null;
try {
tempFile = new File(tmpChannel.getPath());
FileOutputStream fos = new FileOutputStream(tempFile);
daos = new DataOutputStream(new BufferedOutputStream(fos, bufferSize));
long writeStart = System.currentTimeMillis();
int valsLeft = NUM_INTS_WRITTEN;
while (valsLeft-- > 0) {
rec.setValue(valsLeft);
rec.write(new OutputViewDataOutputStreamWrapper(daos));
}
daos.close();
daos = null;
long writeElapsed = System.currentTimeMillis() - writeStart;
// ----------------------------------------------------------------
FileInputStream fis = new FileInputStream(tempFile);
dais = new DataInputStream(new BufferedInputStream(fis, bufferSize));
long readStart = System.currentTimeMillis();
valsLeft = NUM_INTS_WRITTEN;
while (valsLeft-- > 0) {
rec.read(new InputViewDataInputStreamWrapper(dais));
}
dais.close();
dais = null;
long readElapsed = System.currentTimeMillis() - readStart;