BufferedReader
最快的读取每一行
@Test
public void bufferReaderTest() {
try (BufferedReader bufferedReader = new BufferedReader(new FileReader("D:\\aa.txt"))) {
String line;
while ((line = bufferedReader.readLine()) != null) {
// 处理每一行数据 .....
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
Scanner
相比较Scanner慢一点
@Test
public void scannerTest() {
try (Scanner scanner = new Scanner(new File("D:\\aa.txt"))) {
while (scanner.hasNextLine()) {
// 处理每一行数据 .....
String line = scanner.nextLine();
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
RandomAccessFile
行数达到一定规模,使用此方法读取会非常慢
@Test
public void randomAccessFileTest() {
try (RandomAccessFile accessFile = new RandomAccessFile("D:\\aa.txt", "r")) {
String line;
while ((line = accessFile.readLine()) != null) {
// 处理每一行数据 .....
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
Files
一次把所有数据都读到内存中,当文件非常大时,会消耗掉内存资源导致程序崩掉,文件规模小推荐使用文章来源:https://www.toymoban.com/news/detail-514503.html
@Test
public void filesTest() {
try {
List<String> lines = Files.readAllLines(Paths.get("D:\\aa.txt"));
lines.forEach(line -> {
// 处理每一行数据 .....
});
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
示例代码
统计每一行日志ip出现的次数文章来源地址https://www.toymoban.com/news/detail-514503.html
package io;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.RandomAccessFile;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
/**
* @Author: Lisy
* @Date: 2023/04/17/9:51
* @Description: 读取文件中每一行的数据
*/
@Slf4j
public class ReadLineTest {
private final String FILE_NAME = "D:\\aa.txt";
private Map<String, Integer> StringMap = new HashMap<>();
@Test
public void bufferReaderTest() {
try (BufferedReader bufferedReader = new BufferedReader(new FileReader("D:\\aa.txt"))) {
String line;
while ((line = bufferedReader.readLine()) != null) {
// 处理每一行数据 .....
processLines(line);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
print("BufferedReader");
}
@Test
public void scannerTest() {
try (Scanner scanner = new Scanner(new File(FILE_NAME))) {
while (scanner.hasNextLine()) {
// 处理每一行数据 .....
String line = scanner.nextLine();
processLines(line);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
print("Scanner");
}
@Test
public void randomAccessFileTest() {
try (RandomAccessFile accessFile = new RandomAccessFile(FILE_NAME, "r")) {
String line;
while ((line = accessFile.readLine()) != null) {
// 处理每一行数据 .....
processLines(line);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
print("RandomAccessFile");
}
@Test
public void filesTest() {
try {
List<String> lines = Files.readAllLines(Paths.get(FILE_NAME));
// lines.forEach(line -> {
// // 处理每一行数据 .....
// processLines(line);
// });
// 处理每一行数据 .....,方法引用更简洁
lines.forEach(this::processLines);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
print("Files.readAllLines");
}
private void print(String name) {
log.info("************* {} *******************", name);
StringMap.forEach((k, v) -> {
if (v != 1) {
log.info("ip: {} count: {}", k, v);
}
});
StringMap.clear();
}
private void processLines(String line) {
String[] subLine = line.split(" ");
String ip = subLine[subLine.length - 1];
if (StringMap.containsKey(ip)) {
Integer integer = StringMap.get(ip);
StringMap.put(ip, integer + 1);
} else {
StringMap.put(ip, 1);
}
}
}
测试数据
2023-04-14 09:50:51,211 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.172
2023-04-14 09:50:51,211 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,212 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,212 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.69
2023-04-14 09:50:51,212 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.159
2023-04-14 09:50:51,212 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.161
2023-04-14 09:50:51,213 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.68
2023-04-14 09:50:51,213 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.186
2023-04-14 09:50:51,213 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.74
2023-04-14 09:50:51,213 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,214 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,214 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.95
2023-04-14 09:50:51,214 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.87
2023-04-14 09:50:51,214 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.127
2023-04-14 09:50:51,215 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.91
2023-04-14 09:50:51,215 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.115
2023-04-14 09:50:51,216 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.198
2023-04-14 09:50:51,216 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.105
2023-04-14 09:50:51,216 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.60
2023-04-14 09:50:51,216 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.60
2023-04-14 09:50:51,217 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.77
2023-04-14 09:50:51,217 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.125
2023-04-14 09:50:51,217 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.60
2023-04-14 09:50:51,217 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.173
2023-04-14 09:50:51,218 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.129
2023-04-14 09:50:51,218 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.208
2023-04-14 09:50:51,218 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.211
2023-04-14 09:50:51,218 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.63
2023-04-14 09:50:51,219 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.170
2023-04-14 09:50:51,219 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.195
2023-04-14 09:50:51,219 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.181
2023-04-14 09:50:51,219 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.180
2023-04-14 09:50:51,220 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.61
2023-04-14 09:50:51,220 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.201
2023-04-14 09:50:51,220 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.90
2023-04-14 09:50:51,220 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.26
2023-04-14 09:50:51,221 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.200
2023-04-14 09:50:51,221 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.126
2023-04-14 09:50:51,221 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.192
2023-04-14 09:50:51,221 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.96
2023-04-14 09:50:51,221 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.59
2023-04-14 09:50:51,222 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.50
2023-04-14 09:50:51,222 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,222 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,223 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.125
2023-04-14 09:50:51,223 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.82
2023-04-14 09:50:51,223 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.150
2023-04-14 09:50:51,223 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.209
2023-04-14 09:50:51,224 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.170
2023-04-14 09:50:51,224 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.51
2023-04-14 09:50:51,224 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.152
2023-04-14 09:50:51,224 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.21
2023-04-14 09:50:51,224 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.71
2023-04-14 09:50:51,225 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.88
2023-04-14 09:50:51,225 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.188
2023-04-14 09:50:51,225 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.187
2023-04-14 09:50:51,225 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.81
2023-04-14 09:50:51,226 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.155
2023-04-14 09:50:51,226 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.57
2023-04-14 09:50:51,226 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.148
2023-04-14 09:50:51,226 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.156
2023-04-14 09:50:51,226 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.154
2023-04-14 09:50:51,227 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.146
2023-04-14 09:50:51,227 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.160
2023-04-14 09:50:51,227 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.60
2023-04-14 09:50:51,227 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.123
2023-04-14 09:50:51,227 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.60
2023-04-14 09:50:51,228 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.184
2023-04-14 09:50:51,228 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.151
2023-04-14 09:50:51,228 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.182
2023-04-14 09:50:51,229 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.113
2023-04-14 09:50:51,229 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.89
2023-04-14 09:50:51,229 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.191
2023-04-14 09:50:51,229 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.205
2023-04-14 09:50:51,229 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.60
2023-04-14 09:50:51,230 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.74
2023-04-14 09:50:51,230 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.127
2023-04-14 09:50:51,230 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.157
2023-04-14 09:50:51,230 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.165
2023-04-14 09:50:51,231 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.122
2023-04-14 09:50:51,231 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.162
2023-04-14 09:50:51,231 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.183
2023-04-14 09:50:51,231 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.202
2023-04-14 09:50:51,232 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.166
2023-04-14 09:50:51,232 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,234 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.210
2023-04-14 09:50:51,234 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.93
2023-04-14 09:50:51,234 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.171
2023-04-14 09:50:51,234 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.204
2023-04-14 09:50:51,235 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.207
2023-04-14 09:50:51,235 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.199
2023-04-14 09:50:51,235 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.124
2023-04-14 09:50:51,235 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,236 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.123
2023-04-14 09:50:51,236 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.107
2023-04-14 09:50:51,236 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.169
2023-04-14 09:50:51,236 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.76
2023-04-14 09:50:51,236 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.94
2023-04-14 09:50:51,237 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.176
2023-04-14 09:50:51,237 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.24
2023-04-14 09:50:51,237 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.177
2023-04-14 09:50:51,237 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.23
2023-04-14 09:50:51,238 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.149
2023-04-14 09:50:51,238 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.75
2023-04-14 09:50:51,238 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.62
2023-04-14 09:50:51,239 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,239 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,239 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.70
2023-04-14 09:50:51,239 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.197
2023-04-14 09:50:51,239 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.60
2023-04-14 09:50:51,240 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.174
2023-04-14 09:50:51,240 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.114
2023-04-14 09:50:51,240 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.121
2023-04-14 09:50:51,240 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.189
2023-04-14 09:50:51,241 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.106
2023-04-14 09:50:51,241 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.126
2023-04-14 09:50:51,241 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.153
2023-04-14 09:50:51,241 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.167
2023-04-14 09:50:51,242 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.60
2023-04-14 09:50:51,242 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.190
2023-04-14 09:50:51,242 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.175
2023-04-14 09:50:51,242 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.206
2023-04-14 09:50:51,243 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.108
2023-04-14 09:50:51,243 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.112
2023-04-14 09:50:51,243 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.194
2023-04-14 09:50:51,243 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.25
2023-04-14 09:50:51,244 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.185
2023-04-14 09:50:51,244 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.179
2023-04-14 09:50:51,244 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.60
2023-04-14 09:50:51,244 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,245 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.117
2023-04-14 09:50:51,245 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.64
2023-04-14 09:50:51,245 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.193
2023-04-14 09:50:51,245 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.92
2023-04-14 09:50:51,245 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.147
2023-04-14 09:50:51,246 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.116
2023-04-14 09:50:51,246 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.101
2023-04-14 09:50:51,246 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.196
2023-04-14 09:50:51,246 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.203
2023-04-14 09:50:51,246 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.86
2023-04-14 09:50:51,247 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.163
2023-04-14 09:50:51,247 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.178
2023-04-14 09:50:51,247 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.67
2023-04-14 09:50:51,247 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.97
2023-04-14 09:50:51,248 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.145
2023-04-14 09:50:51,248 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.158
2023-04-14 09:50:51,248 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.124
2023-04-14 09:50:51,248 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.111
2023-04-14 09:50:51,248 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.99
2023-04-14 09:50:51,249 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.106.128
2023-04-14 09:50:51,249 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.168
2023-04-14 09:50:51,249 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.128
2023-04-14 09:50:51,249 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 172.31.93.22
2023-04-14 09:50:51,252 INFO [SpringContextShutdownHook] c.i.w.i.WebSocketServiceImpl.onClosing(496) : connection close 192.168.8.164
到了这里,关于java 逐行读取文件(读取文件每一行、按行读取文件)附带示例代码的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!