Changeset 5701


Ignore:
Timestamp:
11/17/09 13:50:05 (10 years ago)
Author:
curtis
Message:

Fix problem with -preload: do not create a DIS if the RAF was directly mapped.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/common/src/loci/common/RandomAccessInputStream.java

    r5683 r5701  
    611611  /** Re-open a file that has been closed */ 
    612612  private void reopen() throws IOException { 
    613     String path = Location.getMappedId(file); 
    614     File f = new File(path).getAbsoluteFile(); 
    615  
    616     raf = Location.getHandle(file); 
    617  
     613    String path; // file path corresponding to this location 
     614    File f; // absolute file on disk corresponding to this location 
     615    raf = Location.getMappedFile(file); 
     616    boolean createDIS = true; 
     617    if (raf == null) { 
     618      // no directly mapped IRandomAccess handle; create a handle 
     619      raf = Location.getHandle(file); 
     620      path = Location.getMappedId(file); 
     621      f = new File(path).getAbsoluteFile(); 
     622    } 
     623    else { 
     624      // an IRandomAccess handle was directly mapped; 
     625      // assume it is superior and skip creation of the DIS 
     626      path = null; 
     627      f = null; 
     628    } 
    618629    if (raf == null) { 
    619630      throw new IOException("File not found: " + file); 
    620631    } 
    621  
    622632    length = raf.length(); 
    623633 
    624     if (f.exists()) { 
     634    if (f != null && f.exists()) { 
    625635      compressed = raf instanceof CompressedRandomAccess; 
    626636      BufferedInputStream bis = new BufferedInputStream( 
Note: See TracChangeset for help on using the changeset viewer.