public List<FileProperties> getFileList() throws Exception {
    if (!Files.isRegularFile(zipFile))
        throw new NoSuchZipFileException();

    List<FileProperties> listFileProperties = new ArrayList<>();

    try (ZipInputStream zipInputStream = new ZipInputStream(Files.newInputStream(zipFile))) {
        ZipEntry entry;
        while ((entry = zipInputStream.getNextEntry()) != null) {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            copyData(zipInputStream, buffer);
            listFileProperties.add(new FileProperties(entry.getName(), entry.getSize(),
                    entry.getCompressedSize(), entry.getMethod()));
        }
        zipInputStream.closeEntry();
    }
    return listFileProperties;
}
I don't understand the purpose of using ByteArrayOutputStream here, and for each entry writing zipInputStream to it. (line 10 and 11). In while loop in each iteration we get information about each entry and added new Properties to list. But what is the purpose creating buffer in each iteration and copying data from zipInputStream to it? What diffrence will be if we delete this two lines? "6. For each ZipEntry, read its contents (otherwise, we won't have information about its size). You can't find the size of a file in an archive without reading it. This is super easy to do using the copyData method and a temporary ByteArrayOutputStream buffer." It's little unclear to me. Thanks!