Class ChilkatObject

java.lang.Object
com.chilkatsoft.chilkat2.ChilkatObject
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
Ai, Asn, AuthAws, AuthAzureSAS, AuthAzureStorage, AuthGoogle, BinData, Bz2, Cache, Cert, CertChain, CertStore, Charset, CodeSign, Compression, Crypt2, Csr, Csv, DateTime, Dh, DirTree, Dkim, Dns, Dsa, DtObj, Ecc, EdDSA, Email, EmailBundle, FileAccess, Formats, Ftp2, Global, Gzip, Hashtable, HtmlToText, HtmlToXml, Http, HttpCurl, HttpRequest, HttpResponse, Imap, JavaKeyStore, Js, JsonArray, JsonObject, Jwe, Jws, Jwt, Log, Mailboxes, MailMan, Mcp, MessageSet, Mht, Mime, Ntlm, OAuth1, OAuth2, Pdf, Pem, Pfx, Pkcs11, PrivateKey, Prng, PublicKey, Rest, Rsa, SCard, ScMinidriver, Scp, Secrets, SecureString, ServerSentEvent, SFtp, SFtpDir, SFtpFile, Socket, Spider, Ssh, SshKey, SshTunnel, Stream, StringArray, StringBuilder, StringTable, Tar, TrustedRoots, UnixCompress, Upload, Url, WebSocket, Xml, XmlCertVault, XmlDSig, XmlDSigGen, Xmp, Zip, ZipCrc, ZipEntry

public abstract class ChilkatObject extends Object implements AutoCloseable
The base class of every Chilkat2 Java class.

An instance owns a native Chilkat object. Release it with close() (try-with-resources is the idiom); an instance that is never closed is freed by a background cleaner once it becomes unreachable, but the garbage collector does not see native memory, so close() is the normal path. After close() every method and property accessor throws IllegalStateException.

Objects are not thread-safe: use an object from one thread at a time. The one documented cross-thread operation is setting the AbortCurrent property of an object that is busy in another thread.

The seven base properties below exist on every class.

  • Method Details

    • isClosed

      public final boolean isClosed()
      Returns whether close() has been called.
      Returns:
      true once this object has been closed
    • close

      public void close()
      Releases the native Chilkat object. Safe to call more than once; every later method or property call throws IllegalStateException. This frees the object only; it does not disconnect or flush anything a class's own methods would.
      Specified by:
      close in interface AutoCloseable
    • toString

      public String toString()
      A short identification (Http[0x...]); never calls into the library, so it is safe in debuggers and on a closed object.
      Overrides:
      toString in class Object
    • getLastErrorText

      public String getLastErrorText()
      The log of the most recent method call: what happened and, on failure, why. Read it right after a call; the next call overwrites it. A ChilkatException carries a copy taken at the moment of failure.
      Returns:
      the text log of the last method called on this object
    • getLastErrorHtml

      public String getLastErrorHtml()
      The log of the most recent method call as HTML.
      Returns:
      the HTML log of the last method called on this object
    • getLastErrorXml

      public String getLastErrorXml()
      The log of the most recent method call as XML.
      Returns:
      the XML log of the last method called on this object
    • getLastMethodSuccess

      public boolean getLastMethodSuccess()
      Whether the most recent method call succeeded. Methods that report failure by exception set it before throwing; methods returning a plain number set it where their description says so.
      Returns:
      the success flag of the last method called on this object
    • setLastMethodSuccess

      public void setLastMethodSuccess​(boolean value)
      Sets the success flag (rarely needed; see getLastMethodSuccess()).
      Parameters:
      value - the new value
    • getVerboseLogging

      public boolean getVerboseLogging()
      Whether LastErrorText is verbose.
      Returns:
      the VerboseLogging flag
    • setVerboseLogging

      public void setVerboseLogging​(boolean value)
      Sets whether LastErrorText is verbose (more detail; larger logs).
      Parameters:
      value - the new value
    • getDebugLogFilePath

      public String getDebugLogFilePath()
      The path of a file to which the library appends its log for every method of this object, or an empty string.
      Returns:
      the debug log file path
    • setDebugLogFilePath

      public void setDebugLogFilePath​(String value)
      Sets the path of a file to which the library appends its log (empty to turn it off).
      Parameters:
      value - the file path (not null)
    • getVersion

      public String getVersion()
      The version of the Chilkat library.
      Returns:
      the library version, such as 11.6.1