这个函数输入一个 file,返回 file 的信息。long[0] 是长度,long[1] 是最后修改。不想定义其他的 class,如何更加优雅的返回信息?
private @Nullable long[] getFileInfo(File file) {
try {
long length = file.length();
long modified = file.lastModified();
return new long[]{length, modified};
} catch (Exception e) {
return null;
}
}