Sample code for 30+ languages & platforms
Java

Workaround for the deprecated Crypt2.CrcBytes method

Shows how to replace the deprecated CrcBytes method. (Chilkat is moving away from the use of CkByteData.)

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[])
  {
    CkCrypt2 crypt = new CkCrypt2();

    String path = "c:/someDir/example.dat";
    String algorithm = "crc-32";

    //  ------------------------------------------------------------------------
    //  The CrcBytes method is deprecated:

    CkByteData inData = new CkByteData();
    inData.loadFile(path);

    int crc = crypt.CrcBytes(algorithm,inData);

    //  ------------------------------------------------------------------------
    //  Workaround.
    //  (Chilkat is moving away from using CkByteData)

    CkBinData bdIn = new CkBinData();
    bdIn.LoadFile(path);

    crc = crypt.CrcBd(algorithm,bdIn);
  }
}