Commit 155f62f9 authored by Quxl's avatar Quxl

x

parent 3c0d7031
...@@ -18,7 +18,6 @@ import java.io.OutputStream; ...@@ -18,7 +18,6 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.io.Writer; import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.nio.file.Files; import java.nio.file.Files;
...@@ -256,8 +255,9 @@ public class FileUtil { ...@@ -256,8 +255,9 @@ public class FileUtil {
*/ */
public static byte[] fileToBytes(File file) { public static byte[] fileToBytes(File file) {
byte[] bytes = null; byte[] bytes = null;
FileInputStream fis = null;
try { try {
FileInputStream fis = new FileInputStream(file); fis = new FileInputStream(file);
ByteArrayOutputStream baos = new ByteArrayOutputStream(102400); ByteArrayOutputStream baos = new ByteArrayOutputStream(102400);
byte[] b = new byte[102400]; byte[] b = new byte[102400];
int n; int n;
...@@ -269,6 +269,14 @@ public class FileUtil { ...@@ -269,6 +269,14 @@ public class FileUtil {
bytes = baos.toByteArray(); bytes = baos.toByteArray();
} catch (Exception e) { } catch (Exception e) {
throw new FileUtilException("", e); throw new FileUtilException("", e);
} finally {
if(fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} }
return bytes; return bytes;
} }
......
...@@ -56,7 +56,6 @@ public class FtpUtil { ...@@ -56,7 +56,6 @@ public class FtpUtil {
this.ftpClient.setFileType(FTP.BINARY_FILE_TYPE, FTP.BINARY_FILE_TYPE); this.ftpClient.setFileType(FTP.BINARY_FILE_TYPE, FTP.BINARY_FILE_TYPE);
this.ftpClient.setFileTransferMode(FTP.BINARY_FILE_TYPE); this.ftpClient.setFileTransferMode(FTP.BINARY_FILE_TYPE);
this.ftpClient.enterLocalPassiveMode(); this.ftpClient.enterLocalPassiveMode();
} }
public void downFolder(final String localRootPath, final String remoteRootPath, boolean async, String backupRootPath) throws IOException { public void downFolder(final String localRootPath, final String remoteRootPath, boolean async, String backupRootPath) throws IOException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment