Java读取本地文件
背景:需要读取本地的log文件,并进行字符的分割
package com.wfbmall.interceptors.com.test;
import java.io.*;
public class test01{
public static void main (String[] args) {
try{
BufferedReader in = new BufferedReader(new FileReader("C://Users//86159//Desktop//wfbmall_4.log"));
String str;
while ((str = in.readLine()) != null) {
String[] tokens = str.split(" ");
//System.out.println(tokens[0]);
System.out.println(String.join("/t", tokens));
}
System.out.println(str);
} catch(IOException e) {
}
}
}


浙公网安备 33010602011771号