Changeset 6107


Ignore:
Timestamp:
04/08/10 14:34:55 (10 years ago)
Author:
melissa
Message:

Make sure that all RandomAccessInputStreams are closed.

Location:
trunk/components/bio-formats/src/loci/formats/in
Files:
3 edited

Legend:

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

    r6026 r6107  
    244244    core[0].interleaved = false; 
    245245 
    246     BufferedImage img = 
    247       ImageIO.read(new DataInputStream(new RandomAccessInputStream(currentId))); 
     246    RandomAccessInputStream ras = new RandomAccessInputStream(currentId); 
     247    DataInputStream dis = new DataInputStream(ras); 
     248    BufferedImage img = ImageIO.read(dis); 
     249    dis.close(); 
     250 
    248251    core[0].sizeX = img.getWidth(); 
    249252    core[0].sizeY = img.getHeight(); 
  • trunk/components/bio-formats/src/loci/formats/in/BioRadReader.java

    r6055 r6107  
    358358 
    359359          DefaultHandler handler = new BioRadHandler(); 
    360           XMLTools.parseXML(new RandomAccessInputStream(path), handler); 
     360          RandomAccessInputStream xml = new RandomAccessInputStream(path); 
     361          XMLTools.parseXML(xml, handler); 
     362          xml.close(); 
    361363 
    362364          used.remove(currentId); 
  • trunk/components/bio-formats/src/loci/formats/in/ImageIOReader.java

    r6026 r6107  
    9090    LOGGER.info("Populating metadata"); 
    9191    core[0].imageCount = 1; 
    92     BufferedImage img = 
    93       ImageIO.read(new DataInputStream(new RandomAccessInputStream(currentId))); 
     92    RandomAccessInputStream ras = new RandomAccessInputStream(currentId); 
     93    DataInputStream dis = new DataInputStream(ras); 
     94    BufferedImage img = ImageIO.read(dis); 
     95    dis.close(); 
    9496    if (img == null) throw new FormatException("Invalid image stream"); 
    9597 
Note: See TracChangeset for help on using the changeset viewer.