提交 481f98cc 编写于 作者: B Blankj

see 12/13 log

上级 1dfcadea
......@@ -190,10 +190,12 @@ listFilesInDirWithFilter : 获取目录下所有符合filter的文件包
searchFileInDir : 获取目录下指定文件名的文件包括子目录
writeFileFromIS : 将输入流写入文件
writeFileFromString : 将字符串写入文件
readFile2List : 指定编码按行读取文件到链表中
readFile2String : 指定编码按行读取文件到字符串中
readFile2Bytes : 读取文件到字符数组中
getFileLastModified : 获取文件最后修改的毫秒时间戳
getFileCharsetSimple : 简单获取文件编码格式
getFileLines : 获取文件行数
readFile2List : 指定编码按行读取文件到List
readFile2SB : 指定编码按行读取文件到StringBuilder中
getDirSize : 获取目录大小
getFileSize : 获取文件大小
getDirLength : 获取目录长度
......
......@@ -495,7 +495,7 @@ public class AppUtils {
* @return {@code true}: 是<br>{@code false}: 否
*/
public static boolean isAppForeground(Context context, String packageName) {
return !StringUtils.isSpace(packageName) && packageName.equals(ProcessUtils.getForegroundProcessName(context));
return !StringUtils.isSpace(packageName) && packageName.equals(ProcessUtils.getForegroundProcessName());
}
/**
......
......@@ -27,6 +27,7 @@ import java.lang.reflect.Method;
* </pre>
*/
public class BarUtils {
private BarUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
......
......@@ -801,7 +801,7 @@ public class FileUtils {
}
/**
* 指定编码按行读取文件到List
* 指定编码按行读取文件到链表中
*
* @param filePath 文件路径
* @param charsetName 编码格式
......@@ -812,7 +812,7 @@ public class FileUtils {
}
/**
* 指定编码按行读取文件到List
* 指定编码按行读取文件到链表中
*
* @param file 文件
* @param charsetName 编码格式
......@@ -823,7 +823,7 @@ public class FileUtils {
}
/**
* 指定编码按行读取文件到List
* 指定编码按行读取文件到链表中
*
* @param filePath 文件路径
* @param st 需要读取的开始行数
......@@ -837,7 +837,7 @@ public class FileUtils {
}
/**
* 指定编码按行读取文件到List
* 指定编码按行读取文件到链表中
*
* @param file 文件
* @param st 需要读取的开始行数
......@@ -940,6 +940,27 @@ public class FileUtils {
}
}
/**
* 获取文件最后修改的毫秒时间戳
*
* @param filePath 文件路径
* @return 文件最后修改的毫秒时间戳
*/
public static long getFileLastModified(String filePath) {
return getFileLastModified(getFileByPath(filePath));
}
/**
* 获取文件最后修改的毫秒时间戳
*
* @param file 文件
* @return 文件最后修改的毫秒时间戳
*/
public static long getFileLastModified(File file) {
if (file == null) return -1;
return file.lastModified();
}
/**
* 简单获取文件编码格式
*
......
......@@ -174,6 +174,11 @@ public class FileUtilsTest {
assertThat(getFileLines(path + "UTF8.txt")).isEqualTo(7);
}
@Test
public void testGetFileLastModified()throws Exception{
System.out.println(TimeUtils.millis2String(getFileLastModified(path)));
}
@Test
public void testReadFile2List() throws Exception {
System.out.println(readFile2List(path + "UTF8.txt", "").toString());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册