Hi,
I have always used the java.io. classes for
java IO. I tried to compare the performance of the io and nio classes FileChannel and ByteBuffers with the normal FileInput/OutputStreams and found that the normal java io was faster than nio.
I wrote a simple program that reads a file into a ByteBuffer/Byte Array and writes the output to a FileOutputStream/ByteBuffer.
The ByteBuffer requires additional operations that might be resulting in a delay. After every read you need to do a flip on a ByteBuffer and before every read(), you need to clear the buffer. These operations might be causing delays.
The code for the two approaches:
The Old IO class took less than 1 milisecond to complete and the new io class took 20 miliseconds to complete.
Any thoughts???
Thanks
Sameer