Changeset 5683


Ignore:
Timestamp:
11/11/09 10:57:23 (10 years ago)
Author:
melissa
Message:

Reduced initialization time for Flex datasets.

Location:
trunk/components
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/FlexReader.java

    r5677 r5683  
    3131 
    3232import loci.common.DataTools; 
     33import loci.common.FileHandle; 
    3334import loci.common.Location; 
    3435import loci.common.LogTools; 
     
    205206        DataTools.unpackBytes(q, buf, i * bpp, bpp, isLittleEndian()); 
    206207      } 
    207     } 
    208     else { 
    209       System.arraycopy(bytes, 0, buf, 0, bytes.length); 
    210208    } 
    211209 
     
    906904        wellNumber[currentWell][0] = row; 
    907905        wellNumber[currentWell][1] = col; 
    908         s = new RandomAccessInputStream(flexFiles[row][col]); 
     906        s = 
     907          new RandomAccessInputStream(new FileHandle(flexFiles[row][col], "r")); 
    909908        TiffParser tp = new TiffParser(s); 
    910909        ifds[row][col] = tp.getIFDs(); 
  • trunk/components/common/src/loci/common/RandomAccessInputStream.java

    r5487 r5683  
    127127  } 
    128128 
    129   /** Constructs a random access stream around the given byte array. */ 
    130   public RandomAccessInputStream(byte[] array) throws IOException { 
    131     // this doesn't use a file descriptor, so we don't need to add it to the 
    132     // file cache 
    133     raf = new ByteArrayHandle(array); 
     129  /** Constructs a random access stream around the given handle. */ 
     130  public RandomAccessInputStream(IRandomAccess handle) throws IOException { 
     131    raf = handle; 
    134132    fp = 0; 
    135133    afp = 0; 
    136134    length = raf.length(); 
     135    fileCache.put(this, true); 
     136    openFiles++; 
     137    if (openFiles > MAX_FILES) cleanCache(); 
     138  } 
     139 
     140  /** Constructs a random access stream around the given byte array. */ 
     141  public RandomAccessInputStream(byte[] array) throws IOException { 
     142    this(new ByteArrayHandle(array)); 
    137143  } 
    138144 
Note: See TracChangeset for help on using the changeset viewer.