0

我想在 zip“archive.zip”中的“imp”目录中编辑文件“application.properties”。我为此使用 Truezip。我尝试同时使用 TFileOutputStream 和 TFileWriter。但是他们俩都在创建一个tmp文件,而不是在 zip 中编辑实际文件。zip 中的实际文件仍然保持不变。以下是我的代码示例: 1. 使用 TFileOutputStream:

    OutputStream out = new TFileOutputStream("C:\sample\archive.zip\imp\application.properties");
    // Loading properties code here
    properties.store(out, null);
    out.close();
  1. 使用 TFileWriter:
File entry = new TFile("C:\sample\archive.zip\imp\application.properties");
Writer writer = new TFileWriter(entry);
try {
    writer.write("wish.world=Hello world\n");
} finally {
    writer.close();
}

请帮忙。

4

1 回答 1

1

您需要调用TVFS.umount()以保留您的更改。

于 2019-07-30T04:58:29.270 回答