package dvb.epg.dtv;
import java.io.*;
import java.util.StringTokenizer;public class ReadFile
{
private String currentRecord = null;
private BufferedReader file;
private String path;
private StringTokenizer token;
//创建文件对象
public ReadFile()
{
file=new BufferedReader(new InputStreamReader(System.in),1);
}
public ReadFile(String filePath) throws FileNotFoundException{
path=filePath;
file=new BufferedReader(new FileReader(path));
}
//设置文件路径
public void setPath(String filePath){
path = filePath;
try {
file = new BufferedReader(new
FileReader(path));
}
catch (FileNotFoundException e){
}
}
//得到文件路径
public String getPath() {
return path;
}
//关闭文件
public void fileClose() throws IOException
{
file.close();
}
//读取下一行记录,若没有则返回-1
public int nextRecord() {
int returnInt=-1;
try{
currentRecord = file.readLine();
}catch (IOException e)
{
}
if (currentRecord == null){
returnInt=-1;
}else{
token=new StringTokenizer(currentRecord);
returnInt=token.countTokens();
}
return returnInt;
}
public String returnRecord(){
return currentRecord;
}
}
import java.io.*;
import java.util.StringTokenizer;public class ReadFile
{
private String currentRecord = null;
private BufferedReader file;
private String path;
private StringTokenizer token;
//创建文件对象
public ReadFile()
{
file=new BufferedReader(new InputStreamReader(System.in),1);
}
public ReadFile(String filePath) throws FileNotFoundException{
path=filePath;
file=new BufferedReader(new FileReader(path));
}
//设置文件路径
public void setPath(String filePath){
path = filePath;
try {
file = new BufferedReader(new
FileReader(path));
}
catch (FileNotFoundException e){
}
}
//得到文件路径
public String getPath() {
return path;
}
//关闭文件
public void fileClose() throws IOException
{
file.close();
}
//读取下一行记录,若没有则返回-1
public int nextRecord() {
int returnInt=-1;
try{
currentRecord = file.readLine();
}catch (IOException e)
{
}
if (currentRecord == null){
returnInt=-1;
}else{
token=new StringTokenizer(currentRecord);
returnInt=token.countTokens();
}
return returnInt;
}
public String returnRecord(){
return currentRecord;
}
}
解决方案 »
- 用JAVA程序进行邮件发送,出现一个错误,求解决方案???在线等!!!
- jsp 登陆问题
- 有关在JSP中获取年月的问题```各位大大来帮忙看看
- 如何修改Tomcat的Server.xml
- 各位大侠帮帮我~~关于用JSP设计一个简单BOLG
- spring定义bean的xml文件应该放在什么地方的?为什么
- description The server encountered an internal error
- 如何在JSP中调用EXCEL的打印预览功能吗?
- 页面传递参数的问题?
- 请问Apache和Resin怎样结合起来
- 关于jsp和XML问题!
- JRun,WebLogic,WebShpere,JSWDK是些什么东西?
tomcat/conf/web.xml下加:
<mime-mapping>
<extension>xls</extension>
<mime-type>application/msexcel</mime-type>
</mime-mapping>
需要导出的文件头上加:
<%@ page contentType="application/vnd.ms-excel" %>