Now let's implement the createZip(Path source) method, which will zip the file specified by the source argument. Java has a special ZipOutputStream class in the java.util.zip package. It compresses (zips) the data passed to it.
Archiver (part 2)
You must be signed in to leave a comment
11 April 2022, 21:40
If you have done CodeGym in order, this task may be a huge headache, because it's been a long time since we've done inputstreams and outputstreams. Don't reinvent the wheel. Use the classes and methods that already come with Java. Path.getFileName() will save you a lot of trouble here. Likewise, there are built-in methods for adding a ZipEntry to a ZipOutputStream and for closing a ZipEntry (hint: it's not ZipEntry.close(), which doesn't exist). Also there is some non-linearity in the directions here... Some of the steps involve back-tracking up and rewriting code you've written in earlier steps. Kind of a pain, but not that hard to do.
12 August 2020, 14:52
OMG why it has to be so confusing? There's no help, so those who don't understand will just be stuck in here forever, until someone good-hearted appears.