Java
Java
Transition from Zip.GetEntryByIndex to Zip.EntryAt
Provides instructions for replacing deprecated GetEntryByIndex method calls with EntryAt.Chilkat Java Downloads
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();
// ...
// ...
int index = 15;
// ------------------------------------------------------------------------
// The GetEntryByIndex method is deprecated:
CkZipEntry entryObj = zip.GetEntryByIndex(index);
if (zip.get_LastMethodSuccess() == false) {
System.out.println(zip.lastErrorText());
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using EntryAt.
// 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.EntryAt(index,ze);
if (success == false) {
System.out.println(zip.lastErrorText());
return;
}
}
}