//大家帮看看这个文件为何删除不掉,是不是有什么东西没有关掉?
//谢谢。package untitled1;import java.io.FileInputStream;
import java.io.File;
import java.nio.channels.FileChannel;
import java.nio.MappedByteBuffer;public class TestToDel {
public TestToDel() {
} public static void main(String[] args) {
TestToDel testToDel1 = new TestToDel();
int STEP = 256;
FileInputStream fin = null;
File swapFile = new File("C:\\test.dat");
FileChannel fcin = null;
MappedByteBuffer reader = null;
try {
if (reader == null) {
fin = new FileInputStream(swapFile);
fcin = fin.getChannel();
reader = fcin.map(FileChannel.MapMode.READ_ONLY, 0, fcin.size());
}
fcin.close();
fin.close(); swapFile.delete();
}
catch (Exception ex) {
ex.printStackTrace();
return;
}
}
}
//谢谢。package untitled1;import java.io.FileInputStream;
import java.io.File;
import java.nio.channels.FileChannel;
import java.nio.MappedByteBuffer;public class TestToDel {
public TestToDel() {
} public static void main(String[] args) {
TestToDel testToDel1 = new TestToDel();
int STEP = 256;
FileInputStream fin = null;
File swapFile = new File("C:\\test.dat");
FileChannel fcin = null;
MappedByteBuffer reader = null;
try {
if (reader == null) {
fin = new FileInputStream(swapFile);
fcin = fin.getChannel();
reader = fcin.map(FileChannel.MapMode.READ_ONLY, 0, fcin.size());
}
fcin.close();
fin.close(); swapFile.delete();
}
catch (Exception ex) {
ex.printStackTrace();
return;
}
}
}
解决方案 »
- 怎么把浮点型小数转化为百分数????????只取十位数
- 如何通过java得到当前月的前两个月?
- 提个兴趣问题,可以进来看看,知道的请回答下
- 帮看看这是什么异常??
- 求教!!
- 请教一个正则表达式分组的问题
- 桌面程序中,如何限定一个输入框只能输入10个字符,超过10个字符时,再按键或粘贴都不显示?
- public static void main(String [] args)中的string[] args是用来干什么的?
- 用java接受一个矩阵
- 现在swing的双缓存有什么用处和优点?谢谢!
- 一个关于函数的形参传递的问题
- 大家好,我在myeclipse下开发JSP的数据库网站,,那JDBC的数据库驱动程序文件放在哪里啊,我不会,初用,感谢
操作系统是windowsXP sp2。
http://community.csdn.net/Expert/topic/4277/4277692.xml?temp=.4591028