import java.io.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;public class FileIO
{
private static final Log logger; public static String readFile(String filePath, String charset) //从路径中读取文件内容
{
String info = "";
File f = new File(filePath);
if(f.exists())
{
FileInputStream bw = new FileInputStream(f);
int len = bw.available();
byte str[] = new byte[len];
if(bw.read(str) == -1)
info = "";
else
info = new String(str, charset);
bw.close();
bw = null;
}
f = null;
break MISSING_BLOCK_LABEL_101;
IOException e;
e; ----就这句了,老是出现小叉,存在语法错误了。如何解决
logger.error(e);
return info;
}
}
IOException e;
e; ----就这句了,老是出现小叉,存在语法错误了。如何解决
logger.error(e);
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;public class FileIO
{
private static final Log logger; public static String readFile(String filePath, String charset) //从路径中读取文件内容
{
String info = "";
File f = new File(filePath);
if(f.exists())
{
FileInputStream bw = new FileInputStream(f);
int len = bw.available();
byte str[] = new byte[len];
if(bw.read(str) == -1)
info = "";
else
info = new String(str, charset);
bw.close();
bw = null;
}
f = null;
break MISSING_BLOCK_LABEL_101;
IOException e;
e; ----就这句了,老是出现小叉,存在语法错误了。如何解决
logger.error(e);
return info;
}
}
IOException e;
e; ----就这句了,老是出现小叉,存在语法错误了。如何解决
logger.error(e);
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;public class FileIO {
public static String readFile(String filePath, String charset) {
String info = "";
File f = new File(filePath);
try {
if (f.exists()) {
FileInputStream bw = new FileInputStream(f);
int len = bw.available();
byte str[] = new byte[len];
if (bw.read(str) == -1)
info = "";
else
info = new String(str, charset);
bw.close();
}
} catch (IOException e) {
Log logger = LogFactory.getLog(FileIO.class);
logger.error("error", e);
LogFactory.releaseAll();
}
return info;
} public static void main(String[] args) {
readFile("d:/aabb.ccc", "gb2312");
}
}