Skip to content

Commit 2ed1873

Browse files
committed
 closeable接口
1 parent 0538d8f commit 2ed1873

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/code/io/file/StringFileReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @author zixiao
1414
* @date 19/1/10
1515
*/
16-
public class StringFileReader {
16+
public class StringFileReader implements Closeable{
1717

1818
private BufferedRandomAccessFile reader;
1919

@@ -50,7 +50,7 @@ public List<String> readData(int limit) {
5050
/**
5151
* 使用BufferedRandomAccessFile读取文件
5252
*
53-
* @param pos 偏移量
53+
* @param pos 偏移量,从0开始
5454
* @param limit 读取行数
5555
* @return 数据列表
5656
*/
@@ -78,7 +78,7 @@ public void close(){
7878
closeQuietly(reader);
7979
}
8080

81-
private static void closeQuietly(Closeable closeable) {
81+
private void closeQuietly(Closeable closeable) {
8282
try {
8383
if (closeable != null) {
8484
closeable.close();

0 commit comments

Comments
 (0)