Changeset 2196


Ignore:
Timestamp:
02/01/07 09:32:15 (13 years ago)
Author:
melissa
Message:

Close abandoned open files.

Location:
trunk/loci/formats/in
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/LeicaReader.java

    r2182 r2196  
    528528                } 
    529529              } 
     530              ras.close(); 
    530531            } 
    531532            if (h.size() == tempImages) { 
  • trunk/loci/formats/in/ND2Reader.java

    r2187 r2196  
    255255  /* @see IFormatReader#close(boolean) */ 
    256256  public void close(boolean fileOnly) throws FormatException, IOException { 
    257     close(); 
     257    if (fileOnly && in != null) in.close(); 
     258    else if (!fileOnly) close(); 
    258259  } 
    259260 
    260261  /** Closes any open files. */ 
    261262  public void close() throws FormatException, IOException { 
     263    if (in != null) in.close(); 
     264    in = null; 
    262265    currentId = null; 
    263266  } 
  • trunk/loci/formats/in/OIBReader.java

    r2182 r2196  
    6464 
    6565  // -- Fields -- 
     66 
     67  /** Current file */ 
     68  private RandomAccessStream in; 
    6669 
    6770  /** Number of images. */ 
     
    243246  /* @see IFormatReader#close(boolean) */ 
    244247  public void close(boolean fileOnly) throws FormatException, IOException { 
    245     if (!fileOnly) close(); 
     248    if (fileOnly && in != null) in.close(); 
     249    else if (!fileOnly) close(); 
    246250  } 
    247251 
    248252  /** Closes any open files. */ 
    249253  public void close() throws FormatException, IOException { 
     254    if (in != null) in.close(); 
     255    in = null; 
    250256    currentId = null; 
    251257 
     
    280286 
    281287    try { 
    282       RandomAccessStream ras = new RandomAccessStream(id); 
    283       if (ras.length() % 4096 != 0) { 
    284         ras.setExtend(4096 - (int) (ras.length() % 4096)); 
    285       } 
    286       r.setVar("fis", ras); 
     288      in = new RandomAccessStream(id); 
     289      if (in.length() % 4096 != 0) { 
     290        in.setExtend(4096 - (int) (in.length() % 4096)); 
     291      } 
     292      r.setVar("fis", in); 
    287293      r.exec("fs = new POIFSFileSystem(fis)"); 
    288294      r.exec("dir = fs.getRoot()"); 
Note: See TracChangeset for help on using the changeset viewer.