Adding entry to a .tar.gz file using TrueZip pushes that entry with zero size
<p>I am using the <b>TrueZip</b> library to inject an entry to a .tar.gz file. <br>On running my code, I find the file I want to inject getting pushed to the .tar.gz file. <br><br>But the inserted entry has zero size, i.e. it appears that only a placeholder gets created for that entry and its contents are not copied. <br><br>Here is the piece of code:</p>

<pre><code>public class FileCompressUtil {
private static String agentZipFilePath = "C:\\Work\\Sensor\\tar.gz\\agent_2.0_linux_x64.tar.gz";

public static void uncompressAgentPkg (String agentZipFile) throws IOException {
    TFile file = new TFile(agentZipFilePath+"\\activeSensor.cfg");

    TConfig config = TConfig.push();

    try {
        config.setOutputPreferences(config.getOutputPreferences().set(FsOutputOption.GROW));
        TFileOutputStream out = new TFileOutputStream(file);

    } catch (Exception e) {}

}



public static void main (String [] args) throws Exception {
    SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss:SSS");
    System.out.println("Adding entry to archive (start time) :: " +sdf.format(new java.util.Date().getTime()));
    uncompressAgentPkg(agentZipFilePath);
    System.out.println("Entry added (end time) :: " +sdf.format(new java.util.Date().getTime()));
}
</code></pre>

<p>}</p>

<p>This was coded by referring <a href="http://truezip.schlichtherle.de/2011/07/26/appending-to-zip-files/" rel="nofollow">http://truezip.schlichtherle.de/2011/07/26/appending-to-zip-files/</a>.</p>
