Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.IOException;
import java.io.InputStream;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class Main {
    public static void main(String[] args) throws Exception {
        ZipFile zf = new ZipFile("ziptest.zip");

        Stream<? extends ZipEntry> entryStream = zf.stream();
        entryStream.forEach(entry -> {
            try {
                // Get the input stream for the current zip entry
                InputStream is = zf.getInputStream(entry);
                System.out.println(entry.getName());
            } catch (IOException e) {
                e.printStackTrace();
            }

        });
    }
}