Sample code for 30+ languages & platforms
Java

Transition from Zip.FirstMatchingEntry to Zip.EntryMatching

Provides instructions for replacing deprecated FirstMatchingEntry method calls with EntryMatching.

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 pattern = "*.txt";

    //  ------------------------------------------------------------------------
    //  The FirstMatchingEntry method is deprecated:

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

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  Do the equivalent using EntryMatching.
    //  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.EntryMatching(pattern,ze);
    if (success == false) {
        System.out.println(zip.lastErrorText());
        return;
        }
  }
}