Sample code for 30+ languages & platforms
Java

Transition from Zip.AppendSb to Zip.AddSb

Provides instructions for replacing deprecated AppendSb method calls with AddSb.

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;

    CkZip zip = new CkZip();

    //  ...
    //  ...
    String pathInZip = "example.txt";
    CkStringBuilder sb = new CkStringBuilder();
    sb.Append("This is a test");
    String charset = "utf-8";

    //  ------------------------------------------------------------------------
    //  The AppendSb method is deprecated:

    success = zip.AppendSb(pathInZip,sb,charset);

    //  ------------------------------------------------------------------------
    //  For consistency, the name has changed to AddSb.

    success = zip.AddSb(pathInZip,sb,charset);
  }
}