0

我需要一些帮助。
我正在尝试使用 FileOutputStream 将字节写入文件...
但是该文件没有作为我构建的 jar 文件出现在目录中。
或者,如果我以其他方式尝试,即使刷新文件,它也不会向文件中写入任何内容。

这是我当前的代码:

 File ModFile =new File(NameText.getText() + ".mod");
FileOutputStream writer = null;

String toProcess = CodesBox.getText();
int i = Integer.parseInt(CodesBox.getText());
byte codes = (byte) i;  

try {
    writer = new FileOutputStream(ModFile);
    writer.write(codes);

} catch (IOException ex) {
    Logger.getLogger(ModMakerGui.class.getName()).log(Level.SEVERE, null, ex);
}finally{
    try {
        writer.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

请帮忙!

4

1 回答 1

0

@junyi00 For me the file is created. And it shows as movie clip. I think the file should have been created for you too. Just try to see where it is created. Or check your classes NameText and CodesBox whether they are having any error somewhere. Check what is the file name generated.

于 2012-12-19T12:33:07.137 回答