Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro with-entry
- "zip-output-stream に、エントリーを追加する"
- [[entry-name zip-output-stream] & body]
- `(try
- (.putNextEntry ^ZipOutputStream ~zip-output-stream
- (ZipEntry. ^String ~entry-name))
- ~@body
- (finally (.closeEntry ~zip-output-stream))))
- (defn make-archive [output-filename contents]
- (with-open [output (ZipOutputStream. (io/output-stream output-filename))]
- (doseq [{:keys [from to]} contents]
- (with-entry [to output]
- (with-open [in (io/input-stream from)]
- (io/copy in output))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement