自己写的文件分割器,在windows下运行正常,在linux下出问题了。运行分割后,被分割的文件所在目录打不开,感觉是死了,而且重启后文件所在目录还是打不开,真不知道怎么办。不知道是不是代码错了。附上分割器的关键部分代码,希望大家帮我解决下。
到底是什么原因啊?
jb2.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
try {
FileInputStream fis = new
FileInputStream(jtf1.getText());
byte[] b = new
byte[Integer.parseInt(jtf2.getText())*1024];
int n = 0;
while ((n=fis.read(b)) != -1) {
FileOutputStream fos = new FileOutputStream(jtf1.getText()
+ i);
fos.write(b,0,n);
fos.close();
i++;
}
fis.close();
System.out.println(i);
}catch (Exception e1) {
e1.printStackTrace();
}
}
});
到底是什么原因啊?
jb2.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
try {
FileInputStream fis = new
FileInputStream(jtf1.getText());
byte[] b = new
byte[Integer.parseInt(jtf2.getText())*1024];
int n = 0;
while ((n=fis.read(b)) != -1) {
FileOutputStream fos = new FileOutputStream(jtf1.getText()
+ i);
fos.write(b,0,n);
fos.close();
i++;
}
fis.close();
System.out.println(i);
}catch (Exception e1) {
e1.printStackTrace();
}
}
});
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货