📄 fileutil.java
字号:
package com.pegasus.framework.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import com.pegasus.framework.exception.NestedRuntimeException;
public class FileUtil {
public static String readFile(String filename) throws FileNotFoundException, IOException {
return readFile(new File(filename));
}
public static String readFile(File file) {
InputStream inputStream = null;
String result = "";
try {
inputStream = new FileInputStream(file);
result = StreamUtil.readStream(inputStream);
} catch (IOException e) {
throw new NestedRuntimeException("readFile", e);
} catch (Exception e) {
throw new NestedRuntimeException("readFile", e);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
throw new NestedRuntimeException("readFile", e);
}
}
}
return result;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -