ObjectOutputStream oos = new ObjectOutputStream(new GZIPOutputStream(new FileOutputStream(output_file_name))); oos.writeObject(some_serializable_object); oos.close(); // Program goes on to do more stuff.My question is, has the innermost FileOutputStream been closed? Or are those file resources still active at this point?
or is it more proper to do this:
FileOutputStream fos = new FileOutputStream(output_file_name); GZIPOutputStream gzos = new GZIPOutputStream(fos); ObjectOutputStream oos = new ObjectOutputStream(gzos); oos.writeObject(some_serializable_object); oos.close(); gzos.close(); fos.close(); // Program goes on to do more stuff.


Sign In
Create Account


Back to top










