Commit 637e5fec authored by 张永's avatar 张永
parents 1c11b9b7 155f62f9
......@@ -18,7 +18,6 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
......@@ -256,8 +255,9 @@ public class FileUtil {
*/
public static byte[] fileToBytes(File file) {
byte[] bytes = null;
FileInputStream fis = null;
try {
FileInputStream fis = new FileInputStream(file);
fis = new FileInputStream(file);
ByteArrayOutputStream baos = new ByteArrayOutputStream(102400);
byte[] b = new byte[102400];
int n;
......@@ -269,6 +269,14 @@ public class FileUtil {
bytes = baos.toByteArray();
} catch (Exception e) {
throw new FileUtilException("", e);
} finally {
if(fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return bytes;
}
......
......@@ -56,7 +56,6 @@ public class FtpUtil {
this.ftpClient.setFileType(FTP.BINARY_FILE_TYPE, FTP.BINARY_FILE_TYPE);
this.ftpClient.setFileTransferMode(FTP.BINARY_FILE_TYPE);
this.ftpClient.enterLocalPassiveMode();
}
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