B4A Library Chilkat-Bundle

This is a - partially - wrap for the Components of https://www.chilkatsoft.com/

Note that the B4A and B4J wrappers are free but you need a Chilkat License to Unlock the Chilkat Library.
The prices starting at $US 289

Buy a Chilkat License
More information about licensing:
Licensing Explained

Licensing Information:
  • The Bundle provides licenses to all existing Chilkat classes.
  • A 1-Developer license is for a single named developer, 4-Developers allows for up to 4 named developers.
  • A Site-Wide license is for any number of developers at a single company location.
  • A license is valid across all supported operating systems, programming languages, architectures, frameworks, etc.
  • The license covers new versions while maintenance/support has not expired.


The interesting part is "A license is valid across all supported operating systems, programming languages, architectures, frameworks, etc." which means that you only need ONE License to use the Chilkat Library in every programming language you want.

I do use them in the 1st line in Delphi for example. But i also wanted to use them in B4J and B4A so i started doing wrappers for it :)

Chilkat is a cross-language, cross-platform API providing 90+ classes for many Internet protocols, formats, and algorithms.
Some classes need a license: SSH, SFTP, FTP2, HTTP, REST, Socket/TLS, IMAP, ...
Some are free: JSON, XML, Cert, PrivateKey, ...

The Objects wrapped so far are:
  • CkAuthGoogle
  • CkBinData
  • CkCert
  • CkDateTime ' Testedpartially (it is used n the Dropboxtest)
  • CkDtObj ' Testedpartially (it is used n the Dropboxtest)
  • CkEmail
  • CkFileAccess
  • CkFtp2
  • CkFtp2Progress
  • CkGlobal ' Tested. It is needed to Unlock the Chilkat Library
  • CkHttp ' Tested partially (it is used n the Dropboxtest)
  • CkImap ' Tested partially (it is used in the IMAP Test)
  • CkJavaKeyStore
  • CkJsonObject' Tested partially (it is used n the Dropboxtest)
  • CkJwt
  • CkOAuth2
  • CkPem
  • CkPfx
  • CkPrivateKey
  • CkPrng
  • CkPublicKey
  • CkRest' Tested partially (it is used in the Dropboxtest)
  • CkRsa
  • CkScp
  • CkSFtp
  • CkSFtpDir
  • CkSFtpFile
  • CkSFtpProgress
  • CkSocket
  • CkSsh ' Tested partially (it is used in the SSHtest)
  • CkSshKey
  • CkSshTunnel
  • CkStream' Tested partially (it is used n the Dropboxtest)
  • CkString
  • CkStringArray
  • CkStringBuilder
  • CkTask
  • CkUrl
  • CkWebSocket
  • CkZipCrc
But, honestly, only a few of them are tested as of now :D
I spent a lot of time doing the wraps though

Some notes:
- As the Library behind (-so Files) is written to support multiple languages the Methods are somehow "Crypted" looking at them from a B4X perspective.
I did try to change the Methods and Properties available to be "B4X conform" :)

For example:
Java:
  public int get_AnsiCodePage() {
    return chilkatJNI.CkGlobal_get_AnsiCodePage(swigCPtr, this);
  }

  public void put_AnsiCodePage(int newVal) {
    chilkatJNI.CkGlobal_put_AnsiCodePage(swigCPtr, this, newVal);
  }
The 1st is a getter, the second a setter for the Values inside the native code.

Inside the wrapper such code is translated into
Java:
  public int getAnsiCodePage() {
    return this.getObject().get_AnsiCodePage();
  }

  public void setAnsiCodePage(int newVal) {
      this.getObject().put_AnsiCodePage(newVal);
  }
meaning that in B4A and B4J you would use
B4X:
' Set
global1.AnsiCodepage = 1
' Get
dim cp as Int = global1.AnsiCodepage
- Usually the Methods wants to return something "into a special Object". But all methods also has a similar Method/Property which returns a String instead of using CkString-Object.
Java:
  public void getThreadPoolLogPath2(CkString str) {
      this.getObject().get_ThreadPoolLogPath(str);
  }

  public String getThreadPoolLogPath() {
    return this.getObject().threadPoolLogPath();
  }
getThreadPoolLogPath2(CkString str) will return the result into the CkString Object named str.
and getThreadPoolLogPath() will return the String directly.

Library and Example can be downloaded from this Dropbox Link:

The B4J Version is HERE.
 
Last edited:

MMORETTI964

Member
Licensed User
Longtime User
Perfect! It works!
And the return (if needed by someone) works (false=continue, true=abort).

As you know there is a simple way to get the other events work (without your intervention)?

Thank you.
Maurizio
 

DonManfred

Expert
Licensed User
Longtime User
As you know there is a simple way to get the other events work (without your intervention)?
i know? I know what? :D

BTW: Thank you very much for your Donation! đź‘Ť
 

MMORETTI964

Member
Licensed User
Longtime User
i know? I know what? :D

BTW: Thank you very much for your Donation! đź‘Ť
My Spaghetti-English is horrible!
I would like to mean:

In FTP2Progress there are almost a dozen events Chilkat can fire from FTP2 (you've published only two).
There are a way to get events fired from Chilkat to B4A directly without your intervention?

I think no, because you've extended classes directly in Java to make it works!
However, now I have all I need to finish my porting, thank you very much for your support.

Maurizio
 

DonManfred

Expert
Licensed User
Longtime User
In FTP2Progress there are almost a dozen events Chilkat can fire from FTP2 (you've published only two).
Can you point me into a Documentation-Page of these "missing" Events?
There are a way to get events fired from Chilkat to B4A directly without your intervention?
No. It has to be implemented in the Library somehow. I wasn´t aware that there are more Events which are missing.
However, now I have all I need to finish my porting, thank you very much for your support.
You´re welcome.
 

MMORETTI964

Member
Licensed User
Longtime User
Can you point me into a Documentation-Page of these "missing" Events?

No. It has to be implemented in the Library somehow. I wasn´t aware that there are more Events which are missing.

You´re welcome.

Nearly all methods inside FTP2Progress, in truth are events (even is not really clear).

AbortCheck
BeginDownloadFile
BeginUploadFile
DownloadRate
EndDownloadFile
EndUploadFile
PercentDone (already wrapped)
ProgressInfo (already wrapped)
TaskCompleted
UploadRate
VerifyDeleteDir
VerifyDeleteFile
VerifyDownloadDir
VerifyUploadDir
 

MMORETTI964

Member
Licensed User
Longtime User
If you need to remove the "r" in PercentDoner (remind me to kebab but I need to diet...) let me know, I will change the B4A source...
 

DonManfred

Expert
Licensed User
Longtime User
If you need to remove the "r" in PercentDoner
I just asked you to try if the even raises when you use PercentDoneR. If so than i need to change the code to raise PercentDone correctly. together with the other missing events.
 

MMORETTI964

Member
Licensed User
Longtime User
I just asked you to try if the even raises when you use PercentDoneR. If so than i need to change the code to raise PercentDone correctly. together with the other missing events.
Do you plan to wrap CkZip / CkZipEntry classes too? Its PercentDone event could be a feature when I need to unzip file ultralarge giving some response-feeling in my app.

Maurizio
 

MMORETTI964

Member
Licensed User
Longtime User
Oh, I haven't see in your list, but I didn't search for it in XML...
Found it! You've missed some classes in your introduction (first post).

Well, I will make some test and report you what found.
 

MMORETTI964

Member
Licensed User
Longtime User
Check Library V0.28 (Download on Dropbox). All FTP2Progress Methods now are Events.
Well, there is almost all.
Missing events:
* AbortCheck
* EndUpload (I see EndDownload twice instead).

Other problems:
After setting PercentDoneScale > 100 (ex: 1000) -> PercentDone won't fire.
DownloadRate / UploadRate doesn't fire.

What version of Chilkat you used? So, I will check if there is some update and try to speak with Chilkat support about it (should be a library problem, I think).
 

MMORETTI964

Member
Licensed User
Longtime User
could be a problem of mine. I´ll check again.

Why it should? 100 is complete. Guess the underlying .so will not do anything in this case.

int get_PercentDoneScale();
void put_PercentDoneScale(int newVal);
Introduced in version 9.5.0.49
This property is only valid in programming environment and languages that allow for event callbacks.
Sets the value to be defined as 100% complete for the purpose of PercentDone event callbacks. The defaut value of 100 means that at most 100 event PercentDone callbacks will occur in a method that (1) is event enabled and (2) is such that it is possible to measure progress as a percentage completed. This property may be set to larger numbers to get more fine-grained PercentDone callbacks. For example, setting this property equal to 1000 will provide callbacks with .1 percent granularity. For example, a value of 453 would indicate 45.3% competed. This property is clamped to a minimum value of 10, and a maximum value of 100000.

Having large files (> 2GB) I tried to have more granularity, however, when we try to scale the percent to 1000 (or even more) percentdone doesn't fire.
No problem: we will use ProgressInfo.

Also give me a chance to get AbortCheck, would be great for us.
As usual, many thanks for your effort.

Maurizio
 

DonManfred

Expert
Licensed User
Longtime User
What version of Chilkat you used?
i am using 9.5.0.84

If i use
B4X:
    ftp.EventCallbackObject = cb
    ftp.PercentDoneScale = 1000
I get 1000 FTP_PercentDone Events for a big file. 44030022 bytes

FTP_PercentDone(1)
FTP_PercentDone(2)
FTP_PercentDone(3)
FTP_PercentDone(4)
FTP_PercentDone(5)
FTP_PercentDone(6)
FTP_PercentDone(7)
FTP_PercentDone(8)
FTP_PercentDone(9)
FTP_PercentDone(10)
[...]
FTP_PercentDone(990)
FTP_PercentDone(991)
FTP_PercentDone(992)
FTP_PercentDone(993)
FTP_PercentDone(994)
FTP_PercentDone(995)
FTP_PercentDone(996)
FTP_PercentDone(997)
FTP_PercentDone(998)
FTP_PercentDone(999)
FTP_PercentDone(1000)
 
Top