文件读写
File fileO = new File("d://writer.txt");
File fileI = new File("d://read.txt");
FileInputStream in=new FileInputStream(fileI );
FileOutputStream out=new FileOutputStream(fileO ,true);
byte[]b=new byte[12];
int len=0;
while((len=in.read(b))!=-1){
out.write(b, 0, len);
}
in.close();
out.close();
写:
File file = new File("d://anjuke.txt");
FileOutputStream fos = new FileOutputStream(file,true);
OutputStreamWriter out = new OutputStreamWriter(fos);
for(AJKCommunity community : listComm){
out.write(community.toString());
out.write("\n");
}
out.close();
fos.close();