Package com.aelitis.azureus.core.diskmanager

Examples of com.aelitis.azureus.core.diskmanager.MemoryMappedFile


      File fchan = new File( "e:\\fchan.bin" );
      File fmapd = new File( "e:\\fmapd.bin" );
   
      RandomAccessFile raf = new RandomAccessFile( fraf, "rw" );
      FileChannel fc = new RandomAccessFile( fchan, "rw" ).getChannel();
      MemoryMappedFile mmf = new MemoryMappedFile( fmapd );
      mmf.setAccessMode( MemoryMappedFile.MODE_READ_WRITE );
    
      long written = 0;
      long traf = 0;
      long tchan = 0;
      long tmmf = 0;
      int loop = 1;
     
      while( written < MAX_SIZE ) {
        System.out.print("|")if (loop % 80 == 0) System.out.println();
        refreshBuffers();
        long start_pos = new Float(RandomUtils.nextFloat()*(MAX_SIZE-BUFF_SIZE)).longValue();
///////////////////////////////////////////////////////
        long start = System.currentTimeMillis();
        //raf.seek( start_pos );  raf.write( raw );
        traf += System.currentTimeMillis() - start;
///////////////////////////////////////////////////////
        start = System.currentTimeMillis();
        //fc.write( dbb.buff, start_pos );
        tchan += System.currentTimeMillis() - start;
///////////////////////////////////////////////////////
        start = System.currentTimeMillis();
        mmf.write( dbb, 0, start_pos, dbb.limit(DirectByteBuffer.SS_OTHER) );
        tmmf += System.currentTimeMillis() - start;
///////////////////////////////////////////////////////
        written += raw.length;
        loop++;
      }
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.core.diskmanager.MemoryMappedFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.