简易的学生课程成绩系统
源代码在线查看: import.java
软件大小: |
7 K |
上传用户: |
ying_min |
|
|
关键词: |
|
下载地址: |
免注册下载 普通下载
|
|
import java.util.*;
import java.io.*;
public class Import
{
public static void main(String args[])
{
try{
BufferedReader readfile = new BufferedReader(new FileReader("import.csv"));
RandomAccessFile writefile = new RandomAccessFile("database.csv","rw");
String inputline1 = readfile.readLine();
String inputline2;
while(inputline1!=null)
{
long pointer = writefile.getFilePointer();
boolean b = true;
String []s = inputline1.trim().split(",");
while((inputline2=writefile.readLine()) !=null)
{
String [] line = inputline2.trim().split(",");
CompareString q0=new CompareString();
CompareString q1=new CompareString();
if((q0.compare(line[0],s[0])) && (q1.compare(line[1],s[1])))
{
writefile.seek(pointer);
writefile.write(inputline1.getBytes());
b = false;
break;
}
pointer = writefile.getFilePointer();
}
if(b == true)
{
writefile.write(inputline1.getBytes());
writefile.write('\n');
}
inputline1 = readfile.readLine();
}
readfile.close();
writefile.close();
}
catch(FileNotFoundException e)
{
System.out.println("File not found");
}
catch(IOException e)
{
System.out.println("IO Exception");
}
}
}