java

mathpunk 2023-03-10T17:30:06.626379Z

I feel like I’m getting close:

(let [bytes (into-array Byte/TYPE (job :artifacts))]
                        (with-open [zis (ZipInputStream. (ByteArrayInputStream. bytes))]
                          (loop [acc []]
                              (if-let [entry (.getNextEntry zis)]
                                (recur (conj acc {:size (.getSize entry)
                                                  :name (.getName entry)
                                                  :dir? (.isDirectory entry)}))
                                acc))))
What I thought would happen here is, (.getNextEntry zis) would yield the first jot of data, and zis would be pointing at the next jot. That doesn’t seem to be happening? There’s only a single artifact in every job, and I’m expecting quite a few more than that. But surely I’m not supposed to pass (rest zis) to recur

mathpunk 2023-03-10T17:39:22.082149Z

The sizes are all -1 🤔

mathpunk 2023-03-10T17:39:50.172429Z

Maybe I’m not understanding what a ZipEntry is, and I need to turn those entries into input streams themselves? https://stackoverflow.com/a/15667326

mathpunk 2023-03-10T18:14:41.692379Z

All the docs I can find are about files, rather than streams

mathpunk 2023-03-10T18:17:25.081359Z

From this, I’m wondering if it’s my data that’s bad — https://stackoverflow.com/questions/11784102/how-does-zipinputstream-getnextentry-work