Whats wrong with ImageIO ??


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: Whats wrong with ImageIO ??

  1. #1
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560

    Whats wrong with ImageIO ??

    In my efforts to become a modern java programmer I have started using
    ImageIO to load images into my aplications. So I've left the old ways;
    using FileInputStream - reading bytes - using toolKit to make image -
    and closing the stream.

    Well, when using this method
    Code:
    BufferedImage img=ImageIO.read(File f);
    ..there is no ways of closing the inputfile, so one should assume that this
    ImageIO.read -method had the brains to close the file, but apparently it
    doesn't.
    Program crashes occurs during application development, but beware: if you
    have used this ImageIO to load image files, and your program crashes, then
    don't be surprised if the images are GONE !!




    Newsflash;
    I tried with this approach:
    Code:
    File f = new File(cp+"\\dgame\\images\\" + fileName);
    FileInputStream in=new FileInputStream(f);
    diceImages[j] = ImageIO.read(in);
    in.close();
    And now the entire "images" folder is gone, including the backupfolder at
    "images\\backup"


    Until someone can explain this to me I will never touch ImageIO ever again !!!
    Last edited by sjalle; 05-28-2005 at 10:19 PM. Reason: Even more havock !!!
    eschew obfuscation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center