HowTo Close stream on exception (FindBug)

Hi there.
I've just started to use the tool FindBugs which seems to work all right as far as it goes.
But it claims, that in the following code the method may "fail to close stream on exception":
     void writeToFile(String fileName){
          System.out.print("Creating "+fileName+" ..");
          try {
               FileOutputStream fos = new FileOutputStream(new File(fileName));
               PrintWriter o = new PrintWriter(fos);  //this line is marked as error-prone
               o.println("Some String");
               o.close();
          } catch (FileNotFoundException e) {
               e.printStackTrace();
          System.out.println(".done");
     }Whereas if I comment out the line with the o.println-call, everything's fine again for "FindBugs".
I have absolutely no clue to what's meant by "on exception", since neither the line itself nor the following line throws an Exception.
(BTW: adding an "finally" block or closing the stream after the try-catch-block doesn't seem to solve the problem for FindBugs).
So, what's my problem? The code seems to work yet. But FindBugs seems to be a neat tool and since I don't like having code that might fail to close streams on exceptions,
I'd like to hear from some of you how you'd code a simple block like that.
(Add to that: I hate being corrected by a programme (At least as long as this fucker seems to be smarter than me ;) So now it's time for me to learn!! )
Any suggestions about how to improve my programming technique are gratefully taken, as well as blind guessing around about what the hell FindBugs thinks I should do better.
-T-

Hi,
This is the first time I am using findbugs tool. I have this piece of code
<target if="javadoc.packages" name="findbug" >
<!--<available file="etc/javadoc_build.inc" property="javadoc.buildinc"/>-->
<findbugs home="D:\bin\common\_lib\build\findbugs"
output="xml"
outputFile="bcel-fb.xml" >
          <!--<auxClasspath path="${basedir}/lib/Regex.jar" />-->
          <sourcePath path="C:\java.zip" />
<class location="C:\java.zip" />
</findbugs>
</target>
My questions are
1)Is the <auxClasspath> extension required.
2)on running ant task, i get the following error
D:\deepak\buildProcess_2\logging>ant findbug
Buildfile: build.xml
[taskdef] Could not load definitions from resource tasks.properties. It could not be found.
findbug:
findbug:
BUILD FAILED
file:D:/deepak/buildProcess_2/_setup/docs.xml:190: Could not create task or type of type: findbugs.
Ant could not find the task or a class this task relies upon.
This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'findbugs'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
- The task is an Ant optional task and optional.jar is absent
Fix: look for optional.jar in ANT_HOME/lib, download if needed
- The task was not built into optional.jar as dependent
libraries were not found at build time.
Fix: look in the JAR to verify, then rebuild with the needed
libraries, or download a release version from apache.org
- The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
- The task is not an Ant core or optional task
and needs to be declared using <taskdef>.
Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath
Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.
Total time: 3 seconds
Anyone suggest me a solution.
bye,
with regards,
Deepak.

Similar Messages

  • Invalid stream header Exception - AES PBE with SealedObject

    I am trying to do an PBE encryption with AES algorithm and SunJCE provider, using the SealedObject class to encrypt/decrypt the data...
    And Im still getting the "invalid stream header" exception. Ive searched this forum, readed lots of posts, examples etc...
    Here is my code for encryption (i collected it from more classes, so hopefully I didnt forget anything...):
        //assume that INPUT_STREAM is the source of plaintext
        //and OUTPUT_STREAM is the stream to save the ciphertext data to
        char[] pass; //assume initialized password
        SecureRandom r = new SecureRandom();
        byte[] salt = new byte[20];
        r.nextBytes(salt);
        SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
        KeySpec keySpec = new PBEKeySpec(pass, salt, 1536, 128);
        SecretKey pbKey = factory.generateSecret(keySpec);
        SecretKeySpec key = new SecretKeySpec(pbKey.getEncoded(), "AES");
        Cipher ciph = Cipher.getInstance("AES/CTR/NoPadding");
        ciph.init(Cipher.ENCRYPT_MODE, key);
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        int ch;
        while ((ch = INPUT_STREAM.read()) >= 0) {
          byteOut.write(ch);
        SealedObject sealed = new SealedObject(byteOut.toByteArray(), ciph);
        BufferedOutputStream bufOut = new BufferedOutputStream(OUTPUTSTREAM);
        ObjectOutputStream objOut = new ObjectOutputStream(bufOut);   
        objOut.writeObject(sealed);
        objOut.close();
      }And here is my code for decrypting:
        //assume that INPUT_STREAM is the source of ciphertext
        //and OUTPUT_STREAM is the stream to save the plaintext data to
        char[] pass; //assume initialized password
        SecureRandom r = new SecureRandom();
        byte[] salt = new byte[20];
        r.nextBytes(salt);
        SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
        KeySpec keySpec = new PBEKeySpec(pass, salt, 1536, 128);
        SecretKey pbKey = factory.generateSecret(keySpec);
        SecretKeySpec key = new SecretKeySpec(pbKey.getEncoded(), "AES");
        BufferedInputStream bufIn = new BufferedInputStream(INPUT_STREAM);    //MARK #1
        ObjectInputStream objIn = new ObjectInputStream(bufIn);   
        SealedObject sealed = (SealedObject) objIn.readObject();   
        byte[] unsealed = (byte[]) sealed.getObject(key);          //MARK #2
        ByteArrayInputStream byteIn = new ByteArrayInputStream(unsealed);
        int ch;
        while ((ch = byteIn.read()) >= 0) {
          OUTPUT_STREAM.write(ch);
        OUTPUT_STREAM.close();Everytime I run it, it gives me this exception:
    Exception in thread "main" java.io.StreamCorruptedException: invalid stream header: B559ADBE
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
         at javax.crypto.SunJCE_i.<init>(DashoA13*..)
         at javax.crypto.SealedObject.unseal(DashoA13*..)
         at javax.crypto.SealedObject.getObject(DashoA13*..)
         at oopsifrovanie.engine.ItemToCrypt.decrypt(ItemToCrypt.java:91)  //MARKED AS #2
         at oopsifrovanie.Main.main(Main.java:37)    //The class with all code below MARK #1I've also found out that the hashCode of the generated "key" object in the decrypting routine is not the same as the hashCode of the "key" object in the ecrypting routine. Can this be a problem? I assume that maybe yes... but don't know what to do...
    When I delete the r.nextBytes(salt); from both routines, the hashCodes are the same, but that's not the thing I want to do...
    I think, that the source of problem can be this part of code (generating the key):
        SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
        KeySpec keySpec = new PBEKeySpec(pass, salt, 1536, 128);
        SecretKey pbKey = factory.generateSecret(keySpec);
        SecretKeySpec key = new SecretKeySpec(pbKey.getEncoded(), "AES");But I derived it from posts like: [http://forums.sun.com/thread.jspa?threadID=5307763] and [http://stackoverflow.com/questions/992019/java-256bit-aes-encryption] and they claimed it's working there...
    Is there anyone that can help me?
    Btw, I don't want to use any other providers like Bouncycastle etc. and I want to use PBE with AES and also SealedObject to store the parameters of encryption...

    Yes, it really uses only one Cipher object, but it does decoding in a little nonstandard (not often used) way, by using the SealedObject class and its getObject(Key key) method. You can check these links for documentation: [http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#SealedObject] and [http://java.sun.com/javase/6/docs/api/javax/crypto/SealedObject.html] So the question is, why it doesn't work also with the AES routines, because it should.
    Btw, according to [http://java.sun.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunJCEProvider] PBEWithSHA1AndDESede/CBC/PKCS5Padding is a valid JCE algorithm for the Cipher class.
    Firstly, I was generating the key for AES enc./decryption this way and it was working:
    char[] pass; //assume initialized password
    byte[] bpass = new byte[pass.length];
        for (int i = 0; i < pass.length; i++) {
          bpass[i] = (byte) pass;
    SecretKeySpec key = new SecretKeySpec(bpass, "AES");
    But I think, that it really wasn't secure, so I wanted to build a key from the password using the PBE.
    Maybe there's also a way how to do this part of my AES PBE algorithm: *KeySpec keySpec = new PBEKeySpec(pass, salt, 1536, 128);* manually (with my own algorithm), but I dont know how to do it and I'd like it to be really secure.
    Btw, thanks for your will to help.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Stream Corrupted  exception BLOB + Oci driver

    Hi,
    I have used blob which is java object and using Weblogic oci driver. So far things
    are fine. I'm able to inser ,update etc.
    If i change my database charset to UTF8 i get stream corrupted Exception. I'm
    using weblogic 6 and is using its connection pool. i have added connection pool
    settings to config.xml.
    If instead of connection pool i explicitly load driver and while connecting i
    add this to properties object
    props.put("weblogic.oci.min_bind_size", "660");
    props.put("weblogic.codeset","UTF8");
    This works fine.
    Now my problem is how do i set this above mentioned properties to config.xml.
    any help will be appreciated.
    Regards
    -Sugs

    Hey suganda,
    Can you please send me the code you are using for insertion and
    retrieval. I am not able to retrieve a blob, i don't know hy
    i am using oci drivers like you. so please help
    "Soumik" <[email protected]> wrote:
    >
    Hi
    I guess what you can do is.
    Open the weblogic server console
    got to the connection pool that you have
    In the
    Propertie
    (Key=Value) textbox
    write
    weblogic.oci.min_bind_size=660
    weblogic.codeset=UTF8
    the operation will automatically write it to config.xml
    soumik
    "Sugandha" <[email protected]> wrote:
    Hi,
    I have used blob which is java object and using Weblogic oci driver.
    So far things
    are fine. I'm able to inser ,update etc.
    If i change my database charset to UTF8 i get stream corrupted Exception.
    I'm
    using weblogic 6 and is using its connection pool. i have added connection
    pool
    settings to config.xml.
    If instead of connection pool i explicitly load driver and while connecting
    i
    add this to properties object
    props.put("weblogic.oci.min_bind_size", "660");
    props.put("weblogic.codeset","UTF8");
    This works fine.
    Now my problem is how do i set this above mentioned properties to config.xml.
    any help will be appreciated.
    Regards
    -Sugs

  • Invalid stream header exception

    hi all
    I have a program to encrypt/decrypt a file using existing secret key
    which is generated by my java code and it works fine. I got a key from a friend and an encrypted file to decrypt it but the program throws this exception:
    java.io.StreamCorruptedException: invalid stream header: 87449FAA
    Exception in thread "main" java.security.InvalidKeyException: No
    installed provider supports this key: (null) this is my code:
    try
        //throws exception here
        ObjectInputStream in = new ObjectInputStream(new
    FileInputStream("key.dat"));
        key = (SecretKey)in.readObject();
        byte[] raw = key.getEncoded();
        skeySpec = new SecretKeySpec(raw, "AES");
        in.close();
    catch (Exception e)
        System.out.println(e);
    Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, skeySpec); Honestly i don't know how my friend creates the secret key but i think he uses some key generation tools. I suppose the key file is not corrupted because he used it to encrypt/decrypt other files.

    Looks like your friend did not use Java serialization to save the key in the file.
    Edited by: sabre150 on Apr 13, 2008 5:27 PM

  • Auto-close sales order : Exceptions in FM SD_WF_ORDER_REJECT

    Hi Experts,
    I created a program with the function module SD_WF_ORDER_REJECT for auto-close undelivered sales orders whose date exceeds 60 days and I schedule a periodical job to run this program in background, but the job is canceled due to different reasons:
    - Material X is not defined for sales org. X distr.chan.X, language IT
    - Can not modify a fully charged or canceled orders...
    In my program I select with following parameters:   VBUK~LFGSK = 'A'   AND VBUK~VBTYP = 'C'.
    how to handle exceptions in FM SD_WF_ORDER_REJECT ?
    Many thanks in advance!
    ismail

    Moved from SAP ERP Sales and Distribution (SAP SD) to ABAP Development
    G. Lakshmipathi

  • Close stream

    Hi,
    I have this simple case to read an output stream of an external process:
    Process proc = Runtime.getRuntime().exec(parameters);
                   InputStream is = proc.getInputStream();
                   InputStreamReader isr = new InputStreamReader(is);
                   BufferedReader br = new BufferedReader(isr);
                   String line = null;
                   while ((line = br.readLine()) != null) {
                        // do something
                   br.close();
                   isr.close();
                   is.close();
    is it necessary close is, isr and br? Or is it enough close br only?
    Thanks,
    Giulio

    It is sufficient to close br, because br's close method calls its nested reader, and so on.

  • Howto close all open windows?

    Hi,
    I am developing some kind of library, and I would like to close all open windows, dialogs, tooltips in the error case.
    The problem is I don't have control about the windows currently open, many are instantiated by plug-ins.
    Is there a way to get a list of all windows? This way I could go throw the list and simply call dispose() on all.
    Thank you in advance, Clemens

    One possible approach could be trying to track AWT event. I would try to get notified as each Component is added and maintained in a hashtable.
    getToolkit().addAWTEventListener (aWTEventListener, AWTEvent.COMPONENT_EVENT_MASK | AWTEvent.CONTAINER_EVENT_MASK);
    AWTEventListener  aWTEventListener = new AWTEventListener()
            public void eventDispatched (AWTEvent Event)
            // find the component from event source and record it.
    };

  • [b]Stream Corrupted Exception with ORACLE8i LITE[/b]

    Our application on the client needs to insert word documents in the form of BLOBS in the ORACLE I LITE database.
    I am using the below JDBC driver to store and retrieve the BLOB from the database and i have the ODBC driver for the Oracle LITE installed on the machine.
    String jdbcURL = "jdbc:Polite:egcaspacclient";
    String uid = "system";
    String passwd = "***";
    String driver = "oracle.lite.poljdbc.POLJDBCDriver";
    But i try to read the BLOB from the database i am getting a streamCorrupted exception while reading the StreamHeader. I am using ObjectInputStream and ObjectOutputStream to store and retrieve the BLOB information.
    I infact tried the same code with the ORACLE8i database and it is working.
    I read some documentation that Oracle LITE supports storing the BLOBS.
    I am wondering if anything wrong with the driver i am using.
    Also the datatype in the BLOB column of the database is showing as undefined. But i see some information is stored to that column when i insert the BLOB.
    I would appreciate if anybody provide with some clues.
    Thanks
    Surendra

    This forum is meant for discussions about OTN content/site and services.
    Questions about Oracle products and technologies will NOT be answered in this forum. Please post your product or technology related questions in the appropriate product or technology forums, which are monitored by Oracle product managers.
    Product forums:
    http://forums.oracle.com/forums/index.jsp?cat=9
    Technology forums:
    http://forums.oracle.com/forums/index.jsp?cat=10
    As a general guideline, please first search the forum to see if your question is already answered. You will find answers for the most frequently asked questions by simply searching the forum. This will help you to find the answer right away and will save time for all of us.

  • Stream Corrupted Exception using ORACLE LITE 8i

    Our application on the client needs to insert word documents in the form of BLOBS in the ORACLE I LITE database.
    I am using the below JDBC driver to store and retrieve the BLOB from the database and i have the ODBC driver for the Oracle LITE installed on the machine.
    String jdbcURL = "jdbc:Polite:egcaspacclient";
    String uid = "system";
    String passwd = "***";
    String driver = "oracle.lite.poljdbc.POLJDBCDriver";
    But i try to read the BLOB from the database i am getting a streamCorrupted exception while reading the StreamHeader. I am using ObjectInputStream and ObjectOutputStream to store and retrieve the BLOB information.
    I infact tried the same code with the ORACLE8i database and it is working.
    I read some documentation that Oracle LITE supports storing the BLOBS.
    I am wondering if anything wrong with the driver i am using.
    Also the datatype in the BLOB column of the database is showing as undefined. But i see some information is stored to that column when i insert the BLOB.
    I would appreciate if anybody provide with some clues.
    Thanks
    Surendra

    This forum is meant for discussions about OTN content/site and services.
    Questions about Oracle products and technologies will NOT be answered in this forum. Please post your product or technology related questions in the appropriate product or technology forums, which are monitored by Oracle product managers.
    Product forums:
    http://forums.oracle.com/forums/index.jsp?cat=9
    Technology forums:
    http://forums.oracle.com/forums/index.jsp?cat=10
    As a general guideline, please first search the forum to see if your question is already answered. You will find answers for the most frequently asked questions by simply searching the forum. This will help you to find the answer right away and will save time for all of us.

  • Every video streaming site (except youtube) freezes constantly and I cannot update flash

    This problem started randomly happening around two days ago.  I don't know what changed but the last time I tried to watch a stream on twitch.tv the player kept freezing even on the very lowest quality setting.  Everything worked just fine on a different computer and twitch works well on my PS4 (which is wireless no less) browser and the xbox app.  I also tried watching something in vimeo and it would play the video for a few seconds, skip to another video and repeat.  First thing I tried was deleting my cache and cookies etc. with the program ccleaner.  Second thing I tried was uninstalling and reinstalling flash player but when I try I always get "lost connection trying to reconnect" at around 40% into the download.  So the next thing I tried was using a different cat5 cable, using a different port on my router (again, everything else works fine) but no luck.  I've also tried downloading the flash installer from IE and Chrome  After that I tried doing a clean install of flash as instructed here How do I do a clean install of Flash Player?
    I've also tried doing the direct download link but it's still the same issue.
    http://download.macromedia.com/pub/flashplayer/current/support/install_flash_player.exe
    I am officially running out of things to try next.  If anyone could help I would much appreciate it.  I am running on Windows 7 64-bit and my browser of choice is Firefox.  Need any other info, please ask.

    Won't make a difference.  It has to be something on my end because my antivirus hasn't updated in two days.  Tried doing a manual update but it kept starting over near the end.  So I'm running a virus scan in safe mode and if that doesn't work then the internet port on my motherboard is probably going bad.  Still doesn't explain youtube.

  • URL stream throws exception when trying to read from input stream

    Hi guys,
    I tried reading from an input stream which returned a 401. Actually, the server side returns 401 whenever the application server cannot fulfill the client's request, however the 401 contains a message which I will like to read.
    I have tried this with mozilla and the return message is properly displayed even at 401. How can I read this message?

    Oracle home is pointing to wrong location.When we made the change to corrent location.Then we rebuilt the jar file started the managed server it is working fine.

  • Howto close only one JFrame, and not the whole Application?

    I hava a Application (Just a JFrame).
    I open a new JFrame doing some Wizard stuff.
    The user should close the Wizard with the Window-Closer [x].
    But: all open Frames dispose. How can i prevent that?
    The Application uses:
             setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            System.gc();
            System.exit(0);
            //or alternative: dispose();
    });The second JFrame uses:
    frame.addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            frame.dispose();
    });

    System.exit(0) will close all windows in an application if you use it, as it will kill the whole program you have launched from the command-line, you need to call frame.dispose()

  • ZipInputStream.getNextEntry() closes stream?

    I have this functionality wherein i need to read from the same zipfile, but at different times. But once I've read it the first time, it won't let me do it again, it throws a -
    java.io.IOException: Stream closed.
    at jazz.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:143)
    I've tried assigning the ZipInputStream I have to another (like a temp zipfile) and then trying to re-read from the original zipfile, but it still throws me the error.
    Code -
    ZipInputStream zis = mResourceFiles; (this is the original zipfile)
    if (null != zis) {
    String filename = "";
    while ((filename = zis.getNextEntry().getName()) !=null) {
    // add entry to xml file
    sLog.debug("in zis==" + filename);
    ... do something .....
    and then there's another method that uses the same zipfile (mResourceFiles - which is a member variable) and tries to read from it.
    I'm not closing the stream anywhere. I understand that I cannot re-read from a zipfile once I've read from it. What then could be the soln to this?
    Thanks in advance!
    HS

    Hmm .. I've tried creating a new ZipInputStream too - here's what I'm really doing ..
    I have a method that reads all files in the ZipInputStream (member variable in class) by doing this -
    ZipInputStream zis = new ZipInputStream(mResources);
    if (null != zis) {
         ZipEntry entry;
         int offset = 0;
         while ((entry = zis.getNextEntry()) !=null) {
         // add entry to zip file
         zos.putNextEntry(entry); // ZipOutputStream
         // write file
         byte[] buf = new byte[1024];
         int len;
         while ((len = zis.read(buf)) > 0){
         zos.write(buf, 0, len);
         zos.closeEntry();
    Now in another method, I need to get all entries from the same zipfile - reassigning to a new ZipInputStream still throws me the 'Stream closed' error.
    Also, creating a new instance of ZipInputStream (like above) instead of just assigning it to another ZipInputStream throws me the following error -
    Caused by: jazz.util.zip.ZipException: EOF in header
    at jazz.util.zip.ZipInputStream.readLeByte(ZipInputStream.java:115)
    at jazz.util.zip.ZipInputStream.readLeShort(ZipInputStream.java:125)
    at jazz.util.zip.ZipInputStream.readLeInt(ZipInputStream.java:133)
    at jazz.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:147)
    I use ZipInputStream, as opposed to ZipFile as I get passed the zipfile as a ZipInputStream from another class.
    Need help!! :)

  • Howto Close support message in Solution Manager

    Hello,
    Iu2019m installing and setting up the Service Desk on my Solution Monitoring system.
    Iu2019m able now to create a support message in my satellite system with menu action u201CHelp  Create Support Messageu201D. The message is put in the queue and could be edited in the tr-Solution_Manager under the Item u201CService Desk  Messagesu201D. When I open a message Iu2019m able to change the status of the message form u201CNewu201D to u201C in progressu201D etc. but the item u201CConfirmedu201D is always gray!
    Could anyone explain to me how I or the end user could confirm thesupport  message?
    I couldnu2019t find a detailed description about the process flow only a global one.
    Thanks for the information.
    Kind regards,
    Richard Meijn

    Hi Meijn,
    Already solved? If no, check the following customizing.
    In SPRO, SAP Solution Manager -> Scenario-Specific Settings -> Service Desk -> Service Desk -> Status Profile -> Change Status Profile for User Status, then choose status profile "SLFN0001" or your customized profile.
    "Lowest status no." and "Highest status no." shows which status it can be changed to.
    For example, in the following case, you can not change the status from NEW to Confirmed. Also, you can not change it from WIP to NEW. In such cases, target status which you can not change to will be shown as gray in status list.
    Status  Text low high
    10   NEW  10  20
    20...WIP    20  40
    30...
    40   Confirmed 40 40
    I hope this could help...
    Kobayashi

  • How do I close nested streams?

    Hi,
    I learned that it is very important to close streams. But how do I close a nested stream?
    //Open new zip input stream with a nested file input stream
    zip_input_stream = new ZipInputStream(new FileInputStream(zip_archive));
    //Close zip input stream
    zip_input_stream.close();
    //How do I close the file input stream??

    BalusC wrote:
    da.futt wrote:
    There's something to be said for this. After all, there's no guarantee at all that a wrapping stream will close its delegate, is there?
    Under each [http://java.sun.com/developer/technicalArticles/Streams/ProgIOStreams/index.html] tells:
    Similarly, when closing chained streams, you only need to close the outermost stream class because the close() call is automatically trickled through all the chained classes
    When using legacy classes... sure. But I hope you'll readily admit it would be very easy to write an InputStream that doesn't "trickle through"
    Hey, don't look at me like this! I wouldn't bother either. I'm just trying to comfort filestream's paranoia! :)

Maybe you are looking for