Well, you can't close any of those since you don't have their
addresses in the catch block.

If you declared the variables outside of the try (be sure to assign
null to them) then you could test each for null in the catch block and
close those that were non-null.

On May 5, 5:20 am, a a <[email protected]> wrote:
> Dear all devs,
>
> try{
>             File newfile = new File(prefix);
>             FileInputStream fileInput = new FileInputStream(newfile);
>             BufferedInputStream buf = new BufferedInputStream(fileInput);
>             final DataInputStream dataInput = new DataInputStream(buf);
> ......
> .....} catch(Exception e) {
>
> ....// I don't know which should i close.
>
> ....// Can anybody tell me which should i close??
> //newfile.close()  ?
> //fileInput.close() ?
> //buf.close() ?
> // dataInput.close() ?
>
> }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to