java.lang.Object
org.miaixz.bus.core.io.stream.LineCounter
- All Implemented Interfaces:
Closeable,AutoCloseable
行数计数器
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intgetCount()获取行数setLastLineSeparatorAsNewLine(boolean lastLineSeparatorAsNewLine) 设置是否将最后一行分隔符作为新行,Linux下要求最后一行必须带有换行符,不算一行,此处用户选择
-
Constructor Details
-
LineCounter
构造- Parameters:
is- 输入流bufferSize- 缓存大小,小于1则使用默认的1024
-
-
Method Details
-
setLastLineSeparatorAsNewLine
设置是否将最后一行分隔符作为新行,Linux下要求最后一行必须带有换行符,不算一行,此处用户选择- Parameters:
lastLineSeparatorAsNewLine- 是否将最后一行分隔符作为新行- Returns:
- this
-
getCount
public int getCount()获取行数- Returns:
- 行数
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-