Changeset 4017


Ignore:
Timestamp:
05/07/08 14:05:15 (12 years ago)
Author:
curtis
Message:

Clean up close methods.

Location:
trunk/loci/formats
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/FileStitcher.java

    r4004 r4017  
    4444  // -- Fields -- 
    4545 
    46   /** FormatReader to use as a template for constituent readers. */ 
     46  /** 
     47   * FormatReader to use as a template for constituent readers. 
     48   * 
     49   * The constituent readers must be dimension swappers so that the 
     50   * file stitcher can reorganize the dimension order as needed based on 
     51   * the result of the axis guessing algorithm. 
     52   * 
     53   * @see AxisGuesser#getAdjustedDimensionOrder() 
     54   */ 
    4755  private DimensionSwapper reader; 
    4856 
     
    6573  private String[][] files; 
    6674 
    67   /** Used files list. */ 
     75  /** Used files list. Only initialized in certain cases, upon request. */ 
    6876  private String[] usedFiles; 
    6977 
     
    229237  } 
    230238 
    231   /* @see IFormatReader#setId(String) */ 
    232   public void setId(String id) throws FormatException, IOException { 
    233     if (!id.equals(currentId)) initFile(id); 
    234   } 
    235  
    236   /* @see IFormatReader#setId(String, boolean) */ 
    237   public void setId(String id, boolean force) 
    238     throws FormatException, IOException 
    239   { 
    240     if (!id.equals(currentId) || force) initFile(id); 
    241   } 
    242  
    243239  /* @see IFormatReader#getImageCount() */ 
    244240  public int getImageCount() { 
     
    528524    } 
    529525    if (!fileOnly) { 
     526      noStitch = false; 
    530527      readers = null; 
    531528      blankImage = null; 
    532529      blankBytes = null; 
    533530      currentId = null; 
    534     } 
    535   } 
    536  
    537   /* @see IFormatReader#close() */ 
    538   public void close() throws IOException { 
    539     if (readers == null) reader.close(); 
    540     else { 
    541       for (int i=0; i<readers.length; i++) { 
    542         for (int j=0; j<readers[i].length; j++) { 
    543           readers[i][j].close(); 
    544         } 
    545       } 
    546     } 
    547     noStitch = false; 
    548     readers = null; 
    549     blankImage = null; 
    550     blankBytes = null; 
    551     currentId = null; 
    552     fp = null; 
    553     ag = null; 
    554     files = null; 
    555     usedFiles = null; 
    556     blankThumb = null; 
    557     blankThumbBytes = null; 
    558     imagesPerFile = null; 
    559     sizeZ = sizeC = sizeT = null; 
    560     lenZ = lenC = lenT = null; 
    561     core = null; 
    562     series = 0; 
    563     seriesBlocks = null; 
    564     fileVector = seriesNames = null; 
    565     seriesInFile = false; 
     531      fp = null; 
     532      ag = null; 
     533      files = null; 
     534      usedFiles = null; 
     535      blankThumb = null; 
     536      blankThumbBytes = null; 
     537      imagesPerFile = null; 
     538      sizeZ = sizeC = sizeT = null; 
     539      lenZ = lenC = lenT = null; 
     540      core = null; 
     541      series = 0; 
     542      seriesBlocks = null; 
     543      fileVector = seriesNames = null; 
     544      seriesInFile = false; 
     545    } 
    566546  } 
    567547 
     
    809789  } 
    810790 
     791  /* @see IFormatHandler#setId(String) */ 
     792  public void setId(String id) throws FormatException, IOException { 
     793    if (!id.equals(currentId)) initFile(id); 
     794  } 
     795 
     796  /* @see IFormatHandler#setId(String, boolean) */ 
     797  public void setId(String id, boolean force) 
     798    throws FormatException, IOException 
     799  { 
     800    if (!id.equals(currentId) || force) initFile(id); 
     801  } 
     802 
     803  /* @see IFormatHandler#close() */ 
     804  public void close() throws IOException { close(false); } 
     805 
    811806  // -- StatusReporter API methods -- 
    812807 
     
    11001095    } 
    11011096    setSeries(oldSeries); 
    1102  
    1103     // initialize used files list only when requested 
    1104     usedFiles = null; 
    11051097  } 
    11061098 
  • trunk/loci/formats/ImageReader.java

    r3745 r4017  
    431431  public void close(boolean fileOnly) throws IOException { 
    432432    for (int i=0; i<readers.length; i++) readers[i].close(fileOnly); 
     433    if (!fileOnly) currentId = null; 
    433434  } 
    434435 
     
    573574 
    574575  /* @see IFormatHandler#close() */ 
    575   public void close() throws IOException { 
    576     currentId = null; 
    577     for (int i=0; i<readers.length; i++) readers[i].close(); 
    578   } 
     576  public void close() throws IOException { close(false); } 
    579577 
    580578  // -- StatusReporter API methods -- 
Note: See TracChangeset for help on using the changeset viewer.