Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fangyeqing
/
xkl-interface-example-all
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
zhaoyue
8 years ago
Commit
c80701b53c90a9345d249a4b64ca4ee7861b86da
1 parent
e7ff0078
Can read local report
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
src/main/java/com/xkl/Constants.java
src/main/java/com/xkl/FileUtil.java
src/main/java/com/xkl/Constants.java
View file @
c80701b
...
...
@@ -5,7 +5,7 @@ package com.xkl;
*/
public
interface
Constants
{
//
String URL_PREFIX = "http://127.0.0.1:8090";
//
String URL_PREFIX = "http://127.0.0.1:8090";
//String URL_PREFIX = "http://139.129.166.85:8090";
String
URL_PREFIX
=
"https://www.hanhezy.com:8090/"
;
...
...
src/main/java/com/xkl/FileUtil.java
View file @
c80701b
package
main
.
java
.
com
;
package
com
.
xkl
;
import
java.io.BufferedReader
;
...
...
@@ -23,7 +23,7 @@ public class FileUtil {
* @param filePath
*/
public
static
Set
<
String
>
readTxtFile
(
String
filePath
)
{
Set
<
String
>
resSet
=
new
HashSet
<>();
Set
<
String
>
resSet
=
new
HashSet
<
String
>();
try
{
String
encoding
=
"GBK"
;
File
file
=
new
File
(
filePath
);
...
...
@@ -44,16 +44,39 @@ public class FileUtil {
e
.
printStackTrace
();
}
return
resSet
;
}
public
static
String
readLine
(
String
filePath
)
{
Set
<
String
>
resSet
=
new
HashSet
<
String
>();
try
{
String
encoding
=
"GBK"
;
File
file
=
new
File
(
filePath
);
if
(
file
.
isFile
()
&&
file
.
exists
())
{
//判断文件是否存在
InputStreamReader
read
=
new
InputStreamReader
(
new
FileInputStream
(
file
),
encoding
);
//考虑到编码格式
BufferedReader
bufferedReader
=
new
BufferedReader
(
read
);
String
lineTxt
=
null
;
while
((
lineTxt
=
bufferedReader
.
readLine
())
!=
null
)
{
if
(!
lineTxt
.
trim
().
toLowerCase
().
equals
(
""
))
{
return
lineTxt
.
trim
();
}
}
read
.
close
();
}
else
{
System
.
out
.
println
(
"找不到指定的文件"
);
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"读取文件内容出错"
);
e
.
printStackTrace
();
}
return
""
;
}
public
static
void
main
(
String
argv
[])
{
String
filePath
=
"C:\\Users\\zhaoyue\\Desktop\\ids"
;
// "res/";
Set
<
String
>
resSet
=
readTxtFile
(
filePath
);
for
(
String
line
:
resSet
)
{
System
.
out
.
println
(
line
);
}
System
.
out
.
println
(
readLine
(
filePath
));
}
...
...
Please
register
or
login
to post a comment