Java读文件
来源:互联网 发布:淘宝手机人工客服在那 编辑:程序博客网 时间:2024/05/16 02:21
import java.io.DataInputStream;
import java.io.FileInputStream;
public class test{
public static void main(String args[]){
java.lang.String fileName = "C://test.csv";
java.io.File objFile = new java.io.File(fileName);
String record = "";
String [] oneRecord = new String[1000];
int recnumber = 0;
int j = 0;
int index = 0;
try{
FileInputStream fis = new FileInputStream(objFile);
DataInputStream istream = new DataInputStream(fis);
while (objFile.exists() ){
record = istream.readLine();
if(!record.equals("")){
int komokunumber = 0;
oneRecord[recnumber] = record;
System.out.println(" oneRecord[" + recnumber + "]" + record);
do
{
++komokunumber;
++index;
index = record.indexOf(',', index);
}while(index != -1);
String[][] komoku= new String[1000][8];
index = 0;
int endindex = 0;
for (int i=0; i< 8;i++ ){
endindex = record.indexOf(',', index);
if (endindex == -1 || i > 6)
komoku[recnumber][i] = record.substring(index);
else
komoku[recnumber][i] = record.substring(index,endindex);
index = endindex + 1;
System.out.println(" success:"+ komoku[recnumber][i]);
}
recnumber++;
}
}
} catch(Exception e) {
}
}
}
- JAVA读文件写入文件
- java 读文件写文件
- java 读文件 写文件
- java读文件写文件
- Java读文件
- java读文件代码
- java读文件内容
- java读大文件
- java读xml文件
- JAVA 读文件操作
- java读文件 乱码
- 读文件(java)
- Java读文件
- JAVA 读文件方法
- 读文件java
- java 读文件
- java冒泡、读文件
- java 读文件
- 请教一个有关ASP实现调用服务器端EXE文件的问题!
- JBuilder+Weblogic的远程调试设置
- ASP自定义控件的两种实现方法
- 真正的健康,真正的财富
- 11个笑话领悟人生
- Java读文件
- 服务器端的重定向相关类
- 人为何会生病?(1)
- rundll32.exe 用法概述 [转]
- IIS ISAPI Printer远程溢出攻击
- pxeboot
- 让GHOST后的电脑自动修正计算机名与IP地址
- 第一天开始使用Blog
- 再见,dgt