Here's the zip example from the wiki:

                final OutputStream out = new FileOutputStream("myfile.zip");
                ArchiveOutputStream os = new
ArchiveStreamFactory().createArchiveOutputStream("zip", out);

                os.putArchiveEntry(new ZipArchiveEntry("testdata/test1.xml"));
                IOUtils.copy(new FileInputStream(file1), os);
                os.closeArchiveEntry();

                os.putArchiveEntry(new ZipArchiveEntry("testdata/test2.xml"));
                IOUtils.copy(new FileInputStream(file2), os);
                os.closeArchiveEntry();
                
                out.finish();
                os.close();


Questions:

1) the second to last line, out.finish() -- there's no finish method
on an OutputStream.  Is this supposed to be calling the finish method
on the "os" stream, the ArchiveOutputStream I mean.

2) If so ( referring to question #1), why is this necessary?  The docs
make it sound as if finish() is only for when you want to stop and add
some more later . . .

3) Why is the output stream decalred as "final"?

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to