-----很简单的问题,没分了也希望高手看一下-----
public Vector GetFile(String TextFile) throws java.io.IOException
{
String record = new String();
Vector Str=new Vector();
int i = 0;
try {
RandomAccessFile rf3 = new RandomAccessFile(TextFile,"r");
while ((record = rf3.readLine()) != null) {
i ++;
if (i!=1) {
StringTokenizer test1 =new StringTokenizer(record,"\t");
//对每行数据剖分
String[] test_str=new String[7]; //数组初始化
int jj=0;
while (test1.hasMoreTokens())
{
test_str[jj]=test1.nextToken();
System.out.println(test_str[jj]);
jj++;
}
Str.addElement(test_str);
}
//System.out.println(record);
}
if (i==0)
{
Str.addElement("无内容!");
}
rf3.close();
// Str=comm.iso2utf(Str);
}
catch (Exception e) {
System.out.println("read file is error:"+e.getMessage());
}
return Str;
}
请问大家 在这个getfile方法中 我想对每行数据分析 如果非int型 我是不允许写入数据库的
请问在那里写异常 是用Integer.parseInt这个方法嘛?
谁给写个例子最好