16
16
[clojure.tools.build.util.file :as file]
17
17
[clojure.tools.build.util.zip :as zip])
18
18
(:import
19
- [java.io File InputStream FileInputStream BufferedInputStream IOException
20
- OutputStream FileOutputStream BufferedOutputStream ByteArrayOutputStream]
19
+ [java.io File InputStream IOException OutputStream ByteArrayOutputStream]
21
20
[java.nio.file Files]
22
21
[java.nio.file.attribute FileAttribute FileTime]
23
22
[java.util.jar JarEntry JarInputStream JarOutputStream Manifest]))
111
110
out-file (jio/file out-dir path)]
112
111
(if string
113
112
(spit out-file string :append ^boolean append)
114
- (copy-stream! ^InputStream stream (BufferedOutputStream. ( FileOutputStream. out-file ^boolean append) ) buffer))
113
+ (copy-stream! ^InputStream stream (jio/output-stream out-file :append append) buffer))
115
114
(Files/setLastModifiedTime (.toPath out-file) last-modified-time)))
116
115
117
116
(defn- handle-conflict
158
157
; ; write new file, parent dir exists for writing
159
158
(ensure-dir (.getParentFile out-file) out-file)
160
159
(do
161
- (copy-stream! ^InputStream is (BufferedOutputStream. ( FileOutputStream. out-file) ) buffer)
160
+ (copy-stream! ^InputStream is (jio/output-stream out-file) buffer)
162
161
(Files/setLastModifiedTime (.toPath out-file) last-modified-time)
163
162
state)
164
163
173
172
state
174
173
175
174
(str/ends-with? (.getPath lib-file) " .jar" )
176
- (with-open [jis (JarInputStream. (BufferedInputStream. ( FileInputStream. lib-file) ))]
175
+ (with-open [jis (JarInputStream. (jio/input-stream lib-file))]
177
176
(loop [the-state state]
178
177
(if-let [entry (.getNextJarEntry jis)]
179
178
(let [path (.getName entry)
297
296
(.exists (jio/file working-dir " META-INF" " versions" )) (assoc " Multi-Release" " true" ))
298
297
mf-attr-strs))
299
298
(file/ensure-dir (.getParent uber-file))
300
- (with-open [jos (JarOutputStream. (FileOutputStream. uber-file) manifest)]
299
+ (with-open [jos (JarOutputStream. (jio/output-stream uber-file) manifest)]
301
300
(zip/copy-to-zip jos working-dir)))
302
301
(finally
303
- (file/delete working-dir)))))
302
+ (file/delete working-dir)))))
0 commit comments