Sample code for 30+ languages & platforms
Java

Transition from Zip.GetEntryByName to Zip.EntryOf

Provides instructions for replacing deprecated GetEntryByName method calls with EntryOf.

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";

    //  ------------------------------------------------------------------------
    //  The GetEntryByName method is deprecated:

    CkZipEntry entryObj = zip.GetEntryByName(pathInZip);
    if (zip.get_LastMethodSuccess() == false) {
        System.out.println(zip.lastErrorText());
        return;
        }

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  Do the equivalent using EntryOf.
    //  Your application creates a new, empty ZipEntry object which is passed 
    //  in the last argument and filled upon success.

    CkZipEntry ze = new CkZipEntry();
    success = zip.EntryOf(pathInZip,ze);
    if (success == false) {
        System.out.println(zip.lastErrorText());
        return;
        }
  }
}