aboutsummaryrefslogtreecommitdiff
path: root/juick-server-web/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server-web/src/main/java')
-rw-r--r--juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java7
1 files changed, 2 insertions, 5 deletions
diff --git a/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java b/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java
index bf08f31e..971587a8 100644
--- a/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java
+++ b/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java
@@ -17,6 +17,7 @@
package com.juick.server.util;
import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -82,11 +83,7 @@ public class HttpUtils {
attachmentFName = DigestUtils.md5Hex(UUID.randomUUID().toString()) + "." + attachmentType;
fos = new FileOutputStream(Paths.get(tmpDir, attachmentFName).toString());
- byte[] buffer = new byte[10240];
- int len;
- while ((len = is.read(buffer)) > 0) {
- fos.write(buffer, 0, len);
- }
+ IOUtils.copy(is, fos);
} catch (Exception e) {
ex = e;
attachmentFName = null;