Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
common
Commits
637e5fec
Commit
637e5fec
authored
Oct 14, 2020
by
张永
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.linkfern.com/key/common.git
parents
1c11b9b7
155f62f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
FileUtil.java
src/main/java/com/egolm/common/FileUtil.java
+10
-2
FtpUtil.java
src/main/java/com/egolm/common/FtpUtil.java
+0
-1
No files found.
src/main/java/com/egolm/common/FileUtil.java
View file @
637e5fec
...
@@ -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
;
}
}
...
...
src/main/java/com/egolm/common/FtpUtil.java
View file @
637e5fec
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment