public class Tailer extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Tailer.ConsoleLineHandler
命令行打印的行处理器
|
Modifier and Type | Field and Description |
---|---|
static LineHandler |
CONSOLE_HANDLER |
Constructor and Description |
---|
Tailer(File file,
Charset charset,
LineHandler lineHandler)
构造
|
Tailer(File file,
Charset charset,
LineHandler lineHandler,
int initReadLine,
long period)
构造
|
Tailer(File file,
LineHandler lineHandler)
构造,默认UTF-8编码
|
Tailer(File file,
LineHandler lineHandler,
int initReadLine)
构造,默认UTF-8编码
|
Modifier and Type | Method and Description |
---|---|
void |
setStopOnDelete(boolean stopOnDelete)
设置删除文件后是否退出并抛出异常
|
void |
start()
开始监听
|
void |
start(boolean async)
开始监听
|
void |
stop()
结束,此方法需在异步模式或
|
public static final LineHandler CONSOLE_HANDLER
public Tailer(File file, LineHandler lineHandler)
file
- 文件lineHandler
- 行处理器public Tailer(File file, LineHandler lineHandler, int initReadLine)
file
- 文件lineHandler
- 行处理器initReadLine
- 启动时预读取的行数,1表示一行public Tailer(File file, Charset charset, LineHandler lineHandler)
file
- 文件charset
- 编码lineHandler
- 行处理器public Tailer(File file, Charset charset, LineHandler lineHandler, int initReadLine, long period)
file
- 文件charset
- 编码lineHandler
- 行处理器initReadLine
- 启动时预读取的行数,1表示一行period
- 检查间隔Copyright © 2024. All rights reserved.