📄 fileio.java
字号:
package com.laoer.bbscs.util;
import java.io.*;
import com.laoer.bbscs.sysinfo.*;
import org.apache.log4j.*;
/**
* <p>Title: 天乙社区V5.0</p>
* <p>Description: BBS-CS天乙社区V5.0</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: laoer.com</p>
* @author 龚天乙
* @version 5.0
*/
public class FileIO {
static Logger logger = Logger.getLogger(FileIO.class.getName());
public FileIO() {
}
public String getPublicFileInfo(String fileName, String sid) {
String publicStr = "";
try {
File fPostFile = new File(Util.getPubFilePath() + fileName);
if (fPostFile.exists()) {
FileInputStream bw = new FileInputStream(fPostFile);
int len = bw.available();
byte[] str = new byte[len];
if (bw.read(str) == -1) {
publicStr = "";
}
else {
if (Sys.isLocale()) {
publicStr = new String(str);
}
else {
publicStr = new String(str, "UTF8");
}
}
bw.close();
bw = null;
}
fPostFile = null;
publicStr = Util.replace(publicStr, "###", sid);
}
catch (IOException e) {
logger.error(e);
}
return publicStr;
}
public String getForumFileInfo(String filePath) {
String strDetail = "";
try {
File fPostFile = new File(filePath);
if (fPostFile.exists()) {
FileInputStream bw = new FileInputStream(fPostFile);
int len = bw.available();
byte[] str = new byte[len];
if (bw.read(str) == -1) {
strDetail = "";
}
else {
if (Sys.isLocale()) {
strDetail = new String(str);
}
else {
strDetail = new String(str, "UTF8");
}
}
bw.close();
bw = null;
}
fPostFile = null;
}
catch (IOException e) {
logger.error(e);
}
if (strDetail.length() > 0) {
int start = strDetail.indexOf("<body>") + 6;
int end = strDetail.lastIndexOf("</body>");
strDetail = strDetail.substring(start, end);
}
return strDetail;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -