Authored by zhaoyue

Can read local report

... ... @@ -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/";
... ...
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));
}
... ...