commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ChadDavis <>
Subject zip example on wiki
Date Fri, 04 Dec 2009 17:13:36 GMT
Here's the zip example from the wiki:

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

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

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


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:
For additional commands, e-mail:

View raw message