Sample code for 30+ languages & platforms
Java

UnGzip .tgz to get a .tar

See more Tar Archive Examples

A .tgz is simply a TAR archive compressed using GZip. It is also commonly referred to as a .tar.gz. Chilkat GZip can be used to ungzip to get an uncompressed .tar.

Chilkat Java Downloads

Java
import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    boolean success = false;

    CkGzip gzip = new CkGzip();

    success = gzip.UncompressFile("qa_data/tar/test.tgz","qa_output/test.tar");
    if (success != true) {
        System.out.println(gzip.lastErrorText());
        }
    else {
        System.out.println("success.");
        }
  }
}