Changeset 6093


Ignore:
Timestamp:
04/06/10 10:29:12 (10 years ago)
Author:
callan
Message:

Added byte buffer provider to compartmentalize the usage of map() vs. allocate() on various platforms. Also fixed test case CLASSPATH for I/O tests.

Location:
trunk/components/common
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/common/build.xml

    r6026 r6093  
    2323    </copy> 
    2424    <testng 
    25         classpath="${test-classes.dir}:${classes.dir}:${component.classpath}"> 
     25        classpath="${test-classes.dir}:${classes.dir}:${component.runtime-cp}"> 
    2626      <xmlfileset file="${build.dir}/testng.xml"/> 
    2727      <jvmarg value="-mx${testng.memory}"/> 
     
    3838    </copy> 
    3939    <testng 
    40         classpath="${test-classes.dir}:${classes.dir}:${component.classpath}"> 
     40        classpath="${test-classes.dir}:${classes.dir}:${component.runtime-cp}"> 
    4141      <xmlfileset file="${build.dir}/testng.xml"/> 
    4242      <jvmarg value="-mx${testng.memory}"/> 
  • trunk/components/common/src/loci/common/NIOFileHandle.java

    r6066 r6093  
    8181  protected ByteOrder order; 
    8282 
     83  /** Provider class for NIO byte buffers, allocated or memory mapped. */ 
     84  protected NIOByteBufferProvider byteBufferProvider; 
     85 
    8386  // -- Constructors -- 
    8487 
     
    97100    raf = new RandomAccessFile(file, mode); 
    98101    channel = raf.getChannel(); 
     102    byteBufferProvider = new NIOByteBufferProvider(channel, mapMode); 
    99103    buffer(position, 0); 
    100104  } 
     
    475479      offset = bufferStartPosition; 
    476480      ByteOrder byteOrder = buffer == null ? order : getOrder(); 
    477       buffer = ByteBuffer.allocate((int) newSize); 
     481      buffer = byteBufferProvider.allocate(bufferStartPosition, (int) newSize); 
    478482      if (byteOrder != null) setOrder(byteOrder); 
    479       channel.read(buffer, bufferStartPosition); 
    480483    } 
    481484    buffer.position((int) (offset - bufferStartPosition)); 
Note: See TracChangeset for help on using the changeset viewer.