import java.io.*; import java.awt.image.DataBufferByte; import java.nio.channels.FileChannel; import java.nio.*; import java.util.Random; import java.nio.ByteBuffer; class IOSpeedTester { public static void main(String[] args) throws IOException { new IOSpeedTester(); } Random g; int[] j; int rep=1; long t1,t2; boolean ra=false; byte[] b; DataBufferByte dbb; RandomAccessFile raf; FileInputStream fis; BufferedInputStream bis; ByteArrayInputStream bais; MappedByteBuffer mbb; FileChannel fc; ByteBuffer bb; public IOSpeedTester() throws IOException { File file = new File("world_2.mp3"); // 3 MEG //File file = new File("05Oriento.mp3"); //7 MEG //File file = new File("13MartianGarageParty.wav"); //30 MEG int ln=(int)(file.length()); g = new Random(); int tt=0; ///////////////////////////try { for (int rr=0 ; rr<1 ; rr++ ) { t1 = System.currentTimeMillis(); fis = new FileInputStream(file); fis = new FileInputStream(file); bis= new BufferedInputStream(fis); raf = new RandomAccessFile(file,"rw"); fis = new FileInputStream(file); b=new byte[ln]; fis.read(b); // fis.read(b,0,ln); fis = new FileInputStream(file); b=new byte[ln]; fis.read(b,0,ln); bais=new ByteArrayInputStream(b); fis = new FileInputStream(file); b=new byte[ln]; fis.read(b,0,ln); dbb= new DataBufferByte(b,ln); fis = new FileInputStream(file); fc = fis.getChannel(); mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, ln); fis = new FileInputStream(file); bb = ByteBuffer.allocate(32000000); b=new byte[ln]; fis.read(b); bb.put(b); //360 t2 = System.currentTimeMillis(); tt+=(t2-t1); System.out.println("initialize: "+(t2-t1)); //b=null; //fis=null; } System.out.println("Final initialize: "+tt/10); // was "<10000" if (ra==true) { j = new int[ln]; for (int qq=0 ; qq