Class SFtp
- All Implemented Interfaces:
AutoCloseable
Transfer, list, manage, and synchronize files over SFTP.
Chilkat.SFtp is Chilkat's main class for secure file transfer
over SSH. It provides SSH connection and authentication, SFTP subsystem
initialization, uploads, downloads, directory listings, remote file
management, file attributes, handle-based file access, recursive
synchronization, bandwidth throttling, proxy support, host key
fingerprinting, SSH algorithm controls, and detailed diagnostics.
SSH + SFTP setup
Connect to an SSH server, authenticate with password or key-based credentials, then initialize the SFTP subsystem before file operations.
Upload and download
Transfer files using simple path-based APIs, in-memory data, streams, or handle-based methods when lower-level control is needed.
Directory and file management
List directories, create and remove folders, rename files, delete files, inspect attributes, and work with remote paths.
Sync-tree operations
Upload or download directory trees and synchronize local and remote folder structures.
Security controls
Verify host keys, control accepted SSH algorithms, use private keys, and configure proxy or network settings when required.
Diagnostics and reliability
Use detailed error text, session logs, progress callbacks, bandwidth limits, and timeout settings to troubleshoot real-world server behavior.
Common pattern: Connect, authenticate, initialize SFTP, perform file operations using remote paths or handles, close any open handles, and disconnect. Use handle-based APIs for precise control, and synchronization methods for recursive folder transfers.
For an extended overview, see SFtp Class Overview.
</section>
Event-capable: long-running methods report progress through a ProgressListener installed
with setProgressListener(ProgressListener), onAbortCheck(BooleanSupplier),
onPercentDone(IntPredicate) or onProgressInfo(BiConsumer).
Instances hold a native Chilkat object: close them with ChilkatObject.close() (try-with-resources) when
done; an unclosed instance is freed when it becomes unreachable.
- See Also:
- Online reference
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidauthenticatePk(String username, SshKey privateKey)Authenticates the connected SSH session using public-key authentication.voidauthenticatePw(String login, String password)Authenticates the connected SSH session usingloginandpassword.voidauthenticatePwPk(String username, String password, SshKey privateKey)Authenticates with a server that requires both a password and a private key.voidauthenticateSecPw(SecureString login, SecureString password)voidauthenticateSecPwPk(SecureString username, SecureString password, SshKey privateKey)Works like, but receivesauthenticatePwPk(String, String, SshKey)usernameandpasswordinSecureStringobjects.voidClears the internal remote file-attribute cache used whenisgetEnableCache()true.voidClears the in-memory text stored in.getSessionLog()voidcloseHandle(String handle)Closes the remote file or directory handle specified byhandle.voidEstablishes an SSH connection todomainNameon TCP portport.voidconnectThroughSsh(Ssh sshConn, String hostname, int port)Connects tohostnameonportthrough the already connected and authenticatedSshobject insshConn.continueKeyboardAuth(String response)Continues keyboard-interactive authentication by submittingresponsefor the prompts returned by.startKeyboardAuth(String)voidcopyFileAttr(String localFilename, String remoteFilename, boolean isHandle)Copies supported timestamps and attributes from the local file atlocalFilenameto the remote item identified byremoteFilename.voidCreates the remote directory specified bypath.voidCloses the current SSH/SFTP connection.voiddownloadBd(String remoteFilePath, BinData binData)Downloads the remote file atremoteFilePathand appends its bytes tobinData.voiddownloadFile(String handle, String toFilename)Streams the remote file identified byhandleto the local filesystem pathtoFilename.voiddownloadFileByName(String remoteFilePath, String localFilePath)Downloads the remote file atremoteFilePathto the local filesystem pathlocalFilePath.voiddownloadSb(String remoteFilePath, String charset, StringBuilder sb)Downloads the remote file atremoteFilePath, decodes it usingcharset, and appends the text tosb.booleanReturnstruewhen the most recent read forhandlereceived the SFTP end-of-file status.intfileExists(String remotePath, boolean followLinks)Checks the remote item atremotePath.voidRequests that the server flush pending data for the open file identified byhandleto stable storage.booleanSet totrueto request that the currently running Chilkat operation abort.intContains the result code from the most recent call to,authenticatePw(String, String),authenticatePk(String, SshKey), or a corresponding secure-string authentication method.authenticatePwPk(String, String, SshKey)intSpecifies the approximate maximum download rate, in bytes per second.intSpecifies the approximate maximum upload rate, in bytes per second.Specifies the SSH client-identification string sent when a connection is established.This property is normally left unset. Set it only on a multihomed computer when the application must bind the outgoing connection to a specific local network interface.intSpecifies the maximum number of milliseconds allowed for the remote endpoint to accept the TCP connection.intContains the RFC 4253 reason code from the most recent SSHDISCONNECTmessage received from the server.Contains the descriptive text sent with the most recent server SSHDISCONNECTmessage.booleanControls whether Chilkat caches remote file sizes and attributes requested by,getFileSize32(String, boolean, boolean),getFileSize64(String, boolean, boolean),getFileSizeStr(String, boolean, boolean),getFileCreateTimeStr(String, boolean, boolean),getFileLastAccessStr(String, boolean, boolean),getFileLastModifiedStr(String, boolean, boolean),getFileOwner(String, boolean, boolean),getFileGroup(String, boolean, boolean).getFilePermissions(String, boolean, boolean)booleanControls whether SSH compression may be negotiated.booleanEnables automatic resolution of secret specification strings from secure operating-system storage.getFileCreateTimeStr(String pathOrHandle, boolean bFollowLinks, boolean bIsHandle)Returns the remote file's creation date and time.getFileGroup(String pathOrHandle, boolean bFollowLinks, boolean bIsHandle)Returns the remote file's group ownership.getFileLastAccessStr(String pathOrHandle, boolean bFollowLinks, boolean bIsHandle)Returns the remote file's last-access date and time.getFileLastModifiedStr(String pathOrHandle, boolean bFollowLinks, boolean bIsHandle)Returns the remote file's last-modified date and time.Specifies the character encoding used for SFTP filenames.getFileOwner(String pathOrHandle, boolean bFollowLinks, boolean bIsHandle)Returns the remote file's owner.intgetFilePermissions(String pathOrHandle, boolean bFollowLinks, boolean bIsHandle)Returns the remote item's complete POSIX mode value.intgetFileSize32(String pathOrHandle, boolean bFollowLinks, boolean bIsHandle)Returns the remote file's size in bytes as a 32-bit integer.longgetFileSize64(String pathOrHandle, boolean bFollowLinks, boolean bIsHandle)Returns the remote file's size in bytes as a 64-bit integer.getFileSizeStr(String pathOrHandle, boolean bFollowLinks, boolean bIsHandle)Returns the remote file's size in bytes as a decimal string.Restricts SSH cipher negotiation to a single cipher.booleanControls SFTP protocol-version negotiation.intSpecifies the interval, in milliseconds, betweenAbortCheckevent callbacks during operations that support progress events.Specifies the preferred host-key algorithm used during SSH connection establishment.Contains the connected server's host-key fingerprint in Chilkat's legacy MD5 format.getHostKeyFP(String hashAlg, boolean includeKeyType, boolean includeHashName)Returns the connected server's host-key fingerprint usinghashAlg.Specifies the authentication method used by an HTTP proxy.Specifies the optional Windows domain used for NTLM authentication with an HTTP proxy.Specifies the hostname or numeric IP address of an HTTP proxy used to establish the SSH connection.Specifies the password used to authenticate with an HTTP proxy.intSpecifies the HTTP proxy port.Specifies the username used to authenticate with an HTTP proxy.intSpecifies the maximum period, in milliseconds, during which an SFTP operation may make no progress while sending or receiving data.booleanControls whetherandReadDirinclude the specialreadDirListing(String, SFtpDir).and..directory entries.intContains the RFC 4254 channel-open failure code whencannot open the SFTP session channel.initializeSftp()Contains the descriptive text associated withwhengetInitializeFailCode()cannot open the SFTP session channel.initializeSftp()booleanReturnstruewhen Chilkat's last known state indicates that the underlying SSH transport is connected.booleanControls whether SSH and SFTP protocol traffic is accumulated in.getSessionLog()voidgetLastJsonData(JsonObject json)Populatesjsonwith supplemental details produced by the most recent method when such details are available.intContains the numeric code from the most recently received SFTPSSH_FXP_STATUSresponse.Contains the message text from the most recently received SFTPSSH_FXP_STATUSresponse.intSpecifies the maximum packet length used by the underlying SSH transport.booleanIndicates that the server rejected password authentication because the account password must be changed.intSpecifies the value representing 100% completion inPercentDoneevent callbacks.booleanControls the preferred address family when DNS resolution returns both IPv4 and IPv6 addresses.booleanControls whether path-based upload and download methods preserve source timestamps on the destination.Returns the installed listener, ornull.intContains the SFTP protocol version negotiated by, normally a value frominitializeSftp()3through6.Specifies a semicolon-separated list of filename patterns.Specifies a semicolon-separated list of filename patterns.Contains the SSH server-identification string received during connection establishment.Contains the in-memory SSH/SFTP protocol log.Specifies the SOCKS proxy hostname or IPv4 address.Specifies the SOCKS5 password when username/password authentication is required.intSpecifies the SOCKS proxy port.Specifies the SOCKS proxy username.intSelects whether and how a SOCKS proxy is used.intSpecifies the socket receive-buffer size.intSpecifies the socket send-buffer size.booleanControls whethercreates empty remote directories locally.syncTreeDownload(String, String, int, boolean)Specifies comma-separated directives that modifyorsyncTreeUpload(String, String, int, boolean).syncTreeDownload(String, String, int, boolean)voidgetSyncedFiles(StringTable strTab)Appends tostrTabthe relative paths processed by the most recentorsyncTreeUpload(String, String, int, boolean)operation.syncTreeDownload(String, String, int, boolean)Specifies a semicolon-separated list of wildcard filename patterns.Specifies a semicolon-separated list of wildcard directory-name patterns.Specifies a semicolon-separated list of wildcard filename patterns.Specifies a semicolon-separated list of wildcard directory-name patterns.booleanControls theTCP_NODELAYsocket option.Provides comma-separated compatibility, security, and synchronization options for uncommon scenarios.intSpecifies the chunk size, in bytes, used byanduploadFile(String, String).uploadFileByName(String, String)Contains a user-authentication banner received from the server.booleanControls the time zone used by date/time getters.longContains the current transfer byte count for an upload or download in progress.longContains the current 64-bit transfer byte count for an upload or download in progress.voidCreates a hard link fromnewPathto the existing remote file atoldPath.voidOpens the SFTP subsystem and negotiates the SFTP protocol version.booleanlastReadFailed(String handle)Returnstrueif the most recent read associated withhandlefailed; otherwise returnsfalse.intlastReadNumBytes(String handle)Returns the number of bytes received by the most recent read associated withhandle.voidonAbortCheck(BooleanSupplier callback)Installs a listener whose only callback isabortCheck: called everyHeartbeatMsmilliseconds during a long-running method; returntrueto abort it.voidonPercentDone(IntPredicate callback)Installs a listener whose only callback ispercentDone: called with the completion percentage (0..100) as a long-running method progresses; returntrueto abort it.voidonProgressInfo(BiConsumer<String,String> callback)Installs a listener whose only callback isprogressInfo: called with a name/value pair of progress information as a long-running method proceeds.Opens the remote directory specified bypathand returns a handle for reading its entries.Opens or creates the remote file atremotePathand returns a handle for subsequent read or write operations.voidreadDirListing(String handle, SFtpDir dirObj)Reads all remaining directory entries fromhandle, which must have been returned by, and stores them inopenDir(String)dirObj.voidreadFileBd(String handle, int numBytes, BinData bd)Reads up tonumBytesbytes from the current position of the remote file identified byhandleand appends them tobd.readFileText(String handle, int numBytes, String charset)Reads up tonumBytesbytes from the current position ofhandle, decodes the bytes usingcharset, and returns the resulting text.readFileText32(String handle, int offset, int numBytes, String charset)Reads up tonumBytesbytes fromhandleat the 32-bit byteoffset, decodes the bytes usingcharset, and returns the resulting text.readFileText64(String handle, long offset, int numBytes, String charset)Reads up tonumBytesbytes fromhandleat the 64-bit byteoffset, decodes the bytes usingcharset, and returns the resulting text.readFileText64s(String handle, String offset, int numBytes, String charset)Reads up tonumBytesbytes fromhandleat the byte offset supplied as decimal stringoffset, decodes the bytes usingcharset, and returns the resulting text.Returns the target path stored in the symbolic link at remotepath.Asks the server to canonicalizeoriginalPathand returns the resulting absolute remote path.voidDeletes the remote directory specified bypath.voidremoveFile(String filename)Deletes the remote file specified byfilename.voidrenameFileOrDir(String oldPath, String newPath)Renames or moves a remote file or directory fromoldPathtonewPath.voidresumeDownloadFileByName(String remoteFilePath, String localFilePath)Resumes downloadingremoteFilePathto the local filesystem pathlocalFilePath.voidresumeUploadFileByName(String remoteFilePath, String localFilePath)Resumes uploading the local file atlocalFilePathtoremoteFilePath.voidSends an SSHIGNOREmessage.voidsetAbortCurrent(boolean value)Sets theAbortCurrentproperty; seegetAbortCurrent().voidsetAllowedAlgorithms(JsonObject json)Configures the exact set of SSH algorithms permitted for subsequent connections using the settings injson.voidsetBandwidthThrottleDown(int value)Sets theBandwidthThrottleDownproperty; seegetBandwidthThrottleDown().voidsetBandwidthThrottleUp(int value)Sets theBandwidthThrottleUpproperty; seegetBandwidthThrottleUp().voidsetClientIdentifier(String value)Sets theClientIdentifierproperty; seegetClientIdentifier().voidsetClientIpAddress(String value)Sets theClientIpAddressproperty; seegetClientIpAddress().voidsetConnectTimeoutMs(int value)Sets theConnectTimeoutMsproperty; seegetConnectTimeoutMs().voidsetCreateDt(String pathOrHandle, boolean isHandle, DateTime createDateTime)Sets the remote file's creation date and time.voidsetCreateTimeStr(String pathOrHandle, boolean bIsHandle, String dateTimeStr)Sets the remote file's creation date and time.voidsetEnableCache(boolean value)Sets theEnableCacheproperty; seegetEnableCache().voidsetEnableCompression(boolean value)Sets theEnableCompressionproperty; seegetEnableCompression().voidsetEnableSecrets(boolean value)Sets theEnableSecretsproperty; seegetEnableSecrets().voidsetFilenameCharset(String value)Sets theFilenameCharsetproperty; seegetFilenameCharset().voidsetForceCipher(String value)Sets theForceCipherproperty; seegetForceCipher().voidsetForceV3(boolean value)Sets theForceV3property; seegetForceV3().voidsetHeartbeatMs(int value)Sets theHeartbeatMsproperty; seegetHeartbeatMs().voidsetHostKeyAlg(String value)Sets theHostKeyAlgproperty; seegetHostKeyAlg().voidsetHttpProxyAuthMethod(String value)Sets theHttpProxyAuthMethodproperty; seegetHttpProxyAuthMethod().voidsetHttpProxyDomain(String value)Sets theHttpProxyDomainproperty; seegetHttpProxyDomain().voidsetHttpProxyHostname(String value)Sets theHttpProxyHostnameproperty; seegetHttpProxyHostname().voidsetHttpProxyPassword(String value)Sets theHttpProxyPasswordproperty; seegetHttpProxyPassword().voidsetHttpProxyPort(int value)Sets theHttpProxyPortproperty; seegetHttpProxyPort().voidsetHttpProxyUsername(String value)Sets theHttpProxyUsernameproperty; seegetHttpProxyUsername().voidsetIdleTimeoutMs(int value)Sets theIdleTimeoutMsproperty; seegetIdleTimeoutMs().voidsetIncludeDotDirs(boolean value)Sets theIncludeDotDirsproperty; seegetIncludeDotDirs().voidsetKeepSessionLog(boolean value)Sets theKeepSessionLogproperty; seegetKeepSessionLog().voidsetLastAccessDt(String pathOrHandle, boolean isHandle, DateTime accessDateTime)Sets the remote file's last-access date and time.voidsetLastAccessTimeStr(String pathOrHandle, boolean bIsHandle, String dateTimeStr)Sets the remote file's last-access date and time.voidsetLastModifiedDt(String pathOrHandle, boolean isHandle, DateTime modifiedDateTime)Sets the remote file's last-modified date and time.voidsetLastModifiedTimeStr(String pathOrHandle, boolean bIsHandle, String dateTimeStr)Sets the remote file's last-modified date and time.voidsetMaxPacketSize(int value)Sets theMaxPacketSizeproperty; seegetMaxPacketSize().voidsetOwnerAndGroup(String pathOrHandle, boolean isHandle, String owner, String group)Sets the owner and group of the remote item identified bypathOrHandle.voidsetPercentDoneScale(int value)Sets thePercentDoneScaleproperty; seegetPercentDoneScale().voidsetPermissions(String pathOrHandle, boolean isHandle, int permissions)Sets the POSIX permission bits for the remote item identified bypathOrHandle.voidsetPreferIpv6(boolean value)Sets thePreferIpv6property; seegetPreferIpv6().voidsetPreserveDate(boolean value)Sets thePreserveDateproperty; seegetPreserveDate().voidsetProgressListener(ProgressListener listener)Installs the listener that receives this object's progress events (abortCheck,percentDone,progressInfo) during its long-running methods; replaces any listener or lambda installed before;nullremoves it.voidsetReadDirMustMatch(String value)Sets theReadDirMustMatchproperty; seegetReadDirMustMatch().voidsetReadDirMustNotMatch(String value)Sets theReadDirMustNotMatchproperty; seegetReadDirMustNotMatch().voidsetSocksHostname(String value)Sets theSocksHostnameproperty; seegetSocksHostname().voidsetSocksPassword(String value)Sets theSocksPasswordproperty; seegetSocksPassword().voidsetSocksPort(int value)Sets theSocksPortproperty; seegetSocksPort().voidsetSocksUsername(String value)Sets theSocksUsernameproperty; seegetSocksUsername().voidsetSocksVersion(int value)Sets theSocksVersionproperty; seegetSocksVersion().voidsetSoRcvBuf(int value)Sets theSoRcvBufproperty; seegetSoRcvBuf().voidsetSoSndBuf(int value)Sets theSoSndBufproperty; seegetSoSndBuf().voidsetSyncCreateAllLocalDirs(boolean value)Sets theSyncCreateAllLocalDirsproperty; seegetSyncCreateAllLocalDirs().voidsetSyncDirectives(String value)Sets theSyncDirectivesproperty; seegetSyncDirectives().voidsetSyncMustMatch(String value)Sets theSyncMustMatchproperty; seegetSyncMustMatch().voidsetSyncMustMatchDir(String value)Sets theSyncMustMatchDirproperty; seegetSyncMustMatchDir().voidsetSyncMustNotMatch(String value)Sets theSyncMustNotMatchproperty; seegetSyncMustNotMatch().voidsetSyncMustNotMatchDir(String value)Sets theSyncMustNotMatchDirproperty; seegetSyncMustNotMatchDir().voidsetTcpNoDelay(boolean value)Sets theTcpNoDelayproperty; seegetTcpNoDelay().voidsetUncommonOptions(String value)Sets theUncommonOptionsproperty; seegetUncommonOptions().voidsetUploadChunkSize(int value)Sets theUploadChunkSizeproperty; seegetUploadChunkSize().voidsetUserAuthBanner(String value)Sets theUserAuthBannerproperty; seegetUserAuthBanner().voidsetUtcMode(boolean value)Sets theUtcModeproperty; seegetUtcMode().startKeyboardAuth(String login)Begins keyboard-interactive authentication forloginand returns XML describing the server's prompts.voidCreates a symbolic link on the server.voidsyncTreeDownload(String remoteRoot, String localRoot, int mode, boolean recurse)Synchronizes files from the remote directoryremoteRootto the local filesystem directorylocalRoot.voidsyncTreeUpload(String localBaseDir, String remoteBaseDir, int mode, boolean bRecurse)Synchronizes files from the local filesystem directorylocalBaseDirto the remote directoryremoteBaseDir.voidUploads all bytes inbinDatato the remote file atremoteFilePath.voiduploadFile(String handle, String fromLocalFilePath)Streams the local filesystem file atfromLocalFilePathto the remote file identified byhandle.voiduploadFileByName(String remoteFilePath, String localFilePath)Uploads the local filesystem file atlocalFilePathtoremoteFilePath.voiduploadSb(StringBuilder sb, String remoteFilePath, String charset, boolean includeBom)Encodes the text insbusingcharsetand uploads it toremoteFilePath.voidwriteFileBd(String handle, BinData bd)Appends all bytes inbdto the remote file identified byhandle.voidwriteFileText(String handle, String charset, String textData)EncodestextDatausingcharsetand writes the resulting bytes at the current sequential write position forhandle.voidwriteFileText32(String handle, int offset32, String charset, String textData)EncodestextDatausingcharsetand writes the resulting bytes tohandleat the 32-bit byte offsetoffset32.voidwriteFileText64(String handle, long offset64, String charset, String textData)EncodestextDatausingcharsetand writes the resulting bytes tohandleat the 64-bit byte offsetoffset64.voidwriteFileText64s(String handle, String offset64, String charset, String textData)EncodestextDatausingcharsetand writes the resulting bytes tohandleat the byte offset supplied as decimal stringoffset64.Methods inherited from class com.chilkatsoft.chilkat2.ChilkatObject
close, getDebugLogFilePath, getLastErrorHtml, getLastErrorText, getLastErrorXml, getLastMethodSuccess, getVerboseLogging, getVersion, isClosed, setDebugLogFilePath, setLastMethodSuccess, setVerboseLogging, toString
-
Constructor Details
-
SFtp
public SFtp()Creates a newSFtpobject.
-
-
Method Details
-
getAbortCurrent
public boolean getAbortCurrent()Set totrueto request that the currently running Chilkat operation abort. Both synchronous and asynchronous operations can be canceled; a synchronous call may be interrupted by setting this property from another thread.When the abort is observed, the current method returns failure and Chilkat resets this property to
false. If no method is running, it is reset when the next method begins.- Returns:
- the value of the
AbortCurrentproperty
-
setAbortCurrent
public void setAbortCurrent(boolean value)Sets theAbortCurrentproperty; seegetAbortCurrent().- Parameters:
value- the new value
-
getAuthFailReason
public int getAuthFailReason()Contains the result code from the most recent call to,authenticatePw(String, String),authenticatePk(String, SshKey), or a corresponding secure-string authentication method.authenticatePwPk(String, String, SshKey)Value Meaning
1Transport failure: communication was lost, or a network read or write failed or timed out.2Invalid private key: the key format, key type, or key contents are not suitable for public-key authentication.3No mutually supported authentication method is available.4SSH authentication protocol error: an unexpected or invalid message was received.5The server rejected the supplied password or private key.6The SSH session is already authenticated.7The server requires a password change. See.getPasswordChangeRequested()Read this property immediately after an authentication method fails. Also inspect
LastErrorTextfor detailed diagnostics.Lifetime: A later successful authentication does not necessarily reset this value. Consult it only immediately after an authentication method returnsfalse; do not use an older value to describe the current session.- Returns:
- the value of the
AuthFailReasonproperty (read-only)
-
getBandwidthThrottleDown
public int getBandwidthThrottleDown()Specifies the approximate maximum download rate, in bytes per second. The default is0, which disables download throttling.Bandwidth throttling is approximate. Actual throughput can vary because of network latency, SSH framing, buffering, and server behavior.
- Returns:
- the value of the
BandwidthThrottleDownproperty
-
setBandwidthThrottleDown
public void setBandwidthThrottleDown(int value)Sets theBandwidthThrottleDownproperty; seegetBandwidthThrottleDown().- Parameters:
value- the new value
-
getBandwidthThrottleUp
public int getBandwidthThrottleUp()Specifies the approximate maximum upload rate, in bytes per second. The default is0, which disables upload throttling.Bandwidth throttling is approximate. Actual throughput can vary because of network latency, SSH framing, buffering, and server behavior.
- Returns:
- the value of the
BandwidthThrottleUpproperty
-
setBandwidthThrottleUp
public void setBandwidthThrottleUp(int value)Sets theBandwidthThrottleUpproperty; seegetBandwidthThrottleUp().- Parameters:
value- the new value
-
getClientIdentifier
Specifies the SSH client-identification string sent when a connection is established. The default begins withSSH-2.0-Chilkat_followed by the Chilkat version, for exampleSSH-2.0-Chilkat_11.6.0.The value should begin with
SSH-2.0-. A server may disconnect if the identification string is invalid.- Returns:
- the value of the
ClientIdentifierproperty
-
setClientIdentifier
Sets theClientIdentifierproperty; seegetClientIdentifier().- Parameters:
value- the new value (notnull)
-
getClientIpAddress
This property is normally left unset. Set it only on a multihomed computer when the application must bind the outgoing connection to a specific local network interface.Specify a numeric IPv4 or IPv6 address, not a hostname. When the property is empty, the operating system automatically chooses the local address.
- Returns:
- the value of the
ClientIpAddressproperty
-
setClientIpAddress
Sets theClientIpAddressproperty; seegetClientIpAddress().- Parameters:
value- the new value (notnull)
-
getConnectTimeoutMs
public int getConnectTimeoutMs()Specifies the maximum number of milliseconds allowed for the remote endpoint to accept the TCP connection.This setting covers TCP connection establishment. After the socket is connected, receive and transfer inactivity are governed by
and method-specific timeouts.getIdleTimeoutMs()- Returns:
- the value of the
ConnectTimeoutMsproperty
-
setConnectTimeoutMs
public void setConnectTimeoutMs(int value)Sets theConnectTimeoutMsproperty; seegetConnectTimeoutMs().- Parameters:
value- the new value
-
getDisconnectCode
public int getDisconnectCode()Contains the RFC 4253 reason code from the most recent SSHDISCONNECTmessage received from the server. A value of0means no server-provided disconnect code is available.Code Symbolic name
1SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT2SSH_DISCONNECT_PROTOCOL_ERROR3SSH_DISCONNECT_KEY_EXCHANGE_FAILED4SSH_DISCONNECT_RESERVED5SSH_DISCONNECT_MAC_ERROR6SSH_DISCONNECT_COMPRESSION_ERROR7SSH_DISCONNECT_SERVICE_NOT_AVAILABLE8SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED9SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE10SSH_DISCONNECT_CONNECTION_LOST11SSH_DISCONNECT_BY_APPLICATION12SSH_DISCONNECT_TOO_MANY_CONNECTIONS13SSH_DISCONNECT_AUTH_CANCELLED_BY_USER14SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE15SSH_DISCONNECT_ILLEGAL_USER_NAMESee
for the server-provided descriptive text.getDisconnectReason()- Returns:
- the value of the
DisconnectCodeproperty (read-only)
-
getDisconnectReason
Contains the descriptive text sent with the most recent server SSHDISCONNECTmessage. Seefor the corresponding RFC 4253 reason code.getDisconnectCode()The text is supplied by the server and can be empty or generic. An ordinary TCP loss or a local disconnect does not necessarily produce an SSH disconnect reason.
- Returns:
- the value of the
DisconnectReasonproperty (read-only)
-
getEnableCache
public boolean getEnableCache()Controls whether Chilkat caches remote file sizes and attributes requested by,getFileSize32(String, boolean, boolean),getFileSize64(String, boolean, boolean),getFileSizeStr(String, boolean, boolean),getFileCreateTimeStr(String, boolean, boolean),getFileLastAccessStr(String, boolean, boolean),getFileLastModifiedStr(String, boolean, boolean),getFileOwner(String, boolean, boolean),getFileGroup(String, boolean, boolean). The default isgetFilePermissions(String, boolean, boolean)false.When enabled, requesting one attribute by filename causes the complete attribute set for that file to be cached. Later attribute requests for the same filename can be satisfied without another server round trip.
Caching applies only when a remote path is used, not when an open handle is used. Call
when remote metadata may have changed.clearCache()- Returns:
- the value of the
EnableCacheproperty
-
setEnableCache
public void setEnableCache(boolean value)Sets theEnableCacheproperty; seegetEnableCache().- Parameters:
value- the new value
-
getEnableCompression
public boolean getEnableCompression()Controls whether SSH compression may be negotiated. The default isfalse.Some older servers advertise compression but fail when it is enabled. If the server disconnects during or immediately after connection or authentication, try leaving this property
false.- Returns:
- the value of the
EnableCompressionproperty
-
setEnableCompression
public void setEnableCompression(boolean value)Sets theEnableCompressionproperty; seegetEnableCompression().- Parameters:
value- the new value
-
getEnableSecrets
public boolean getEnableSecrets()Enables automatic resolution of secret specification strings from secure operating-system storage. The default isfalse.When
true, supported password properties and authentication methods may receive a value beginning with!!instead of a literal credential. Chilkat resolves the secret from Windows Credential Manager on Windows or Apple Keychain on macOS.Secret specification format:
!![appName|]service[|domain]|username
This feature applies to
,getHttpProxyPassword(),getSocksPassword(), andauthenticatePw(String, String).authenticatePwPk(String, String, SshKey)- Returns:
- the value of the
EnableSecretsproperty
-
setEnableSecrets
public void setEnableSecrets(boolean value)Sets theEnableSecretsproperty; seegetEnableSecrets().- Parameters:
value- the new value
-
getFilenameCharset
Specifies the character encoding used for SFTP filenames. During, Chilkat automatically sets this property when the server supplies ainitializeSftp()filename-charsetextension.When the property is empty, incoming and outgoing filenames use UTF-8. Otherwise, Chilkat uses the specified charset, such as
utf-8,iso-8859-1, orwindows-1252.Use an explicit charset only when required by the server. UTF-8 is the normal SFTP filename encoding.
- Returns:
- the value of the
FilenameCharsetproperty
-
setFilenameCharset
Sets theFilenameCharsetproperty; seegetFilenameCharset().- Parameters:
value- the new value (notnull)
-
getForceCipher
Restricts SSH cipher negotiation to a single cipher. Leave this property empty to use Chilkat's normal preference order. For broader algorithm control, use.setAllowedAlgorithms(JsonObject)Cipher name Family
chacha20-poly1305@openssh.comChaCha20-Poly1305 authenticated encryptionaes128-ctr, aes192-ctr, aes256-ctrAES in CTR modeaes128-cbc, aes192-cbc, aes256-cbcAES in CBC modeaes128-gcm@openssh.com, aes256-gcm@openssh.comAES-GCM authenticated encryptiontwofish128-cbc, twofish256-cbcTwofish in CBC modeblowfish-cbcBlowfish in CBC modeIf the server does not support the selected cipher,
fails.connect(String, int)- Returns:
- the value of the
ForceCipherproperty
-
setForceCipher
Sets theForceCipherproperty; seegetForceCipher().- Parameters:
value- the new value (notnull)
-
getForceV3
public boolean getForceV3()Controls SFTP protocol-version negotiation. The default istrue, which forces use of SFTP v3 even when the server supports a newer version.Set this property to
falsebeforewhen the application needs features introduced in SFTP v4, v5, or v6. After initialization, readinitializeSftp()to determine the negotiated version.getProtocolVersion()- Returns:
- the value of the
ForceV3property
-
setForceV3
public void setForceV3(boolean value)Sets theForceV3property; seegetForceV3().- Parameters:
value- the new value
-
getHeartbeatMs
public int getHeartbeatMs()Specifies the interval, in milliseconds, betweenAbortCheckevent callbacks during operations that support progress events. The default is0, which disables periodic callbacks.- Returns:
- the value of the
HeartbeatMsproperty
-
setHeartbeatMs
public void setHeartbeatMs(int value)Sets theHeartbeatMsproperty; seegetHeartbeatMs().- Parameters:
value- the new value
-
getHostKeyAlg
Specifies the preferred host-key algorithm used during SSH connection establishment. The default isDSS; set it toRSAonly when required for compatibility with a particular server.Normally this property should be left unchanged.
- Returns:
- the value of the
HostKeyAlgproperty
-
setHostKeyAlg
Sets theHostKeyAlgproperty; seegetHostKeyAlg().- Parameters:
value- the new value (notnull)
-
getHostKeyFingerprint
Contains the connected server's host-key fingerprint in Chilkat's legacy MD5 format. The value is set after a successful SSH connection.ssh-rsa 2048 68:ff:d1:4e:6c:ff:d7:b0:d6:58:73:85:07:bc:2e:d5 ssh-ed25519 256 c8:73:22:c7:82:aa:09:f1:1c:4e:99:8a:a0:62:a7:87
For new applications, use
withgetHostKeyFP(String, boolean, boolean)SHA256. Compare the fingerprint with a value obtained from a trusted source before sending credentials.The value is cleared by. Obtain and validate it while the SSH connection is active.disconnect()- Returns:
- the value of the
HostKeyFingerprintproperty (read-only)
-
getHttpProxyAuthMethod
Specifies the authentication method used by an HTTP proxy. Matching is case-insensitive.Value Behavior
empty Automatically negotiate a supported method.
BasicUse HTTP Basic authentication.NTLMUse NTLM authentication.- Returns:
- the value of the
HttpProxyAuthMethodproperty
-
setHttpProxyAuthMethod
Sets theHttpProxyAuthMethodproperty; seegetHttpProxyAuthMethod().- Parameters:
value- the new value (notnull)
-
getHttpProxyDomain
Specifies the optional Windows domain used for NTLM authentication with an HTTP proxy. This property is ignored for Basic authentication.- Returns:
- the value of the
HttpProxyDomainproperty
-
setHttpProxyDomain
Sets theHttpProxyDomainproperty; seegetHttpProxyDomain().- Parameters:
value- the new value (notnull)
-
getHttpProxyHostname
Specifies the hostname or numeric IP address of an HTTP proxy used to establish the SSH connection.Set this property together with
. A configured SOCKS proxy takes precedence whengetHttpProxyPort()isgetSocksVersion()4or5.- Returns:
- the value of the
HttpProxyHostnameproperty
-
setHttpProxyHostname
Sets theHttpProxyHostnameproperty; seegetHttpProxyHostname().- Parameters:
value- the new value (notnull)
-
getHttpProxyPassword
Specifies the password used to authenticate with an HTTP proxy.- Returns:
- the value of the
HttpProxyPasswordproperty
-
setHttpProxyPassword
Sets theHttpProxyPasswordproperty; seegetHttpProxyPassword().- Parameters:
value- the new value (notnull)
-
getHttpProxyPort
public int getHttpProxyPort()Specifies the HTTP proxy port. Common values include8080and3128.The proxy is used when
is nonempty, this property is nonzero, andgetHttpProxyHostname()isgetSocksVersion()0.- Returns:
- the value of the
HttpProxyPortproperty
-
setHttpProxyPort
public void setHttpProxyPort(int value)Sets theHttpProxyPortproperty; seegetHttpProxyPort().- Parameters:
value- the new value
-
getHttpProxyUsername
Specifies the username used to authenticate with an HTTP proxy.- Returns:
- the value of the
HttpProxyUsernameproperty
-
setHttpProxyUsername
Sets theHttpProxyUsernameproperty; seegetHttpProxyUsername().- Parameters:
value- the new value (notnull)
-
getIdleTimeoutMs
public int getIdleTimeoutMs()Specifies the maximum period, in milliseconds, during which an SFTP operation may make no progress while sending or receiving data. The default is30000(30 seconds).Set this property to
0to allow an operation to wait indefinitely.- Returns:
- the value of the
IdleTimeoutMsproperty
-
setIdleTimeoutMs
public void setIdleTimeoutMs(int value)Sets theIdleTimeoutMsproperty; seegetIdleTimeoutMs().- Parameters:
value- the new value
-
getIncludeDotDirs
public boolean getIncludeDotDirs()Controls whetherandReadDirinclude the specialreadDirListing(String, SFtpDir).and..directory entries. The default isfalse.This property controls only the special directory entries
.and... It does not exclude ordinary hidden filenames such as.gitignoreor.profile.- Returns:
- the value of the
IncludeDotDirsproperty
-
setIncludeDotDirs
public void setIncludeDotDirs(boolean value)Sets theIncludeDotDirsproperty; seegetIncludeDotDirs().- Parameters:
value- the new value
-
getInitializeFailCode
public int getInitializeFailCode()Contains the RFC 4254 channel-open failure code whencannot open the SFTP session channel. The initial value isinitializeSftp()0.Code Symbolic name
1SSH_OPEN_ADMINISTRATIVELY_PROHIBITED2SSH_OPEN_CONNECT_FAILED3SSH_OPEN_UNKNOWN_CHANNEL_TYPE4SSH_OPEN_RESOURCE_SHORTAGE- Returns:
- the value of the
InitializeFailCodeproperty (read-only)
-
getInitializeFailReason
Contains the descriptive text associated withwhengetInitializeFailCode()cannot open the SFTP session channel. The text is supplied by the server and may be empty or generic.initializeSftp()- Returns:
- the value of the
InitializeFailReasonproperty (read-only)
-
getIsConnected
public boolean getIsConnected()Returnstruewhen Chilkat's last known state indicates that the underlying SSH transport is connected. This meanssucceeded; it does not mean authentication orconnect(String, int)has completed.initializeSftp()This property is passive and does not perform network I/O. A silent network failure or a peer close may remain undetected until an operation reads from or writes to the socket.
To actively test whether the connection is still writable, call
and check its return value. The server does not reply to an SSHsendIgnore()IGNOREmessage.- Returns:
- the value of the
IsConnectedproperty (read-only)
-
getKeepSessionLog
public boolean getKeepSessionLog()Controls whether SSH and SFTP protocol traffic is accumulated in. The default isgetSessionLog()false.Session logging is intended for diagnostics and grows as activity continues. Disable it when no longer needed and treat the resulting log as potentially sensitive.
- Returns:
- the value of the
KeepSessionLogproperty
-
setKeepSessionLog
public void setKeepSessionLog(boolean value)Sets theKeepSessionLogproperty; seegetKeepSessionLog().- Parameters:
value- the new value
-
getLastStatusCode
public int getLastStatusCode()Contains the numeric code from the most recently received SFTPSSH_FXP_STATUSresponse. This is not necessarily the status of the most recently called method. Methods that return a handle, attributes, or data can complete without receiving a new status response, leaving an older value unchanged. A successful method can therefore leave a previous nonzero status code in this property.Code Symbolic name
0SSH_FX_OK1SSH_FX_EOF2SSH_FX_NO_SUCH_FILE3SSH_FX_PERMISSION_DENIED4SSH_FX_FAILURE5SSH_FX_BAD_MESSAGE6SSH_FX_NO_CONNECTION7SSH_FX_CONNECTION_LOST8SSH_FX_OP_UNSUPPORTED9SSH_FX_INVALID_HANDLE10SSH_FX_NO_SUCH_PATH11SSH_FX_FILE_ALREADY_EXISTS12SSH_FX_WRITE_PROTECT13SSH_FX_NO_MEDIA14SSH_FX_NO_SPACE_ON_FILESYSTEM15SSH_FX_QUOTA_EXCEEDED16SSH_FX_UNKNOWN_PRINCIPAL17SSH_FX_LOCK_CONFLICT18SSH_FX_DIR_NOT_EMPTY19SSH_FX_NOT_A_DIRECTORY20SSH_FX_INVALID_FILENAME21SSH_FX_LINK_LOOP22SSH_FX_CANNOT_DELETE23SSH_FX_INVALID_PARAMETER24SSH_FX_FILE_IS_A_DIRECTORY25SSH_FX_BYTE_RANGE_LOCK_CONFLICT26SSH_FX_BYTE_RANGE_LOCK_REFUSED27SSH_FX_DELETE_PENDING28SSH_FX_FILE_CORRUPT29SSH_FX_OWNER_INVALID30SSH_FX_GROUP_INVALID31SSH_FX_NO_MATCHING_BYTE_RANGE_LOCKSee
for the server-provided message text.getLastStatusMessage()Use each method's documented return value as the primary success test. Read this property immediately after a relevant SFTP failure when the server status provides additional detail.
- Returns:
- the value of the
LastStatusCodeproperty (read-only)
-
getLastStatusMessage
Contains the message text from the most recently received SFTPSSH_FXP_STATUSresponse. The wording is server-dependent.This property can remain unchanged across later successful methods that do not receive a new status response. See
for the numeric code.getLastStatusCode()- Returns:
- the value of the
LastStatusMessageproperty (read-only)
-
getMaxPacketSize
public int getMaxPacketSize()Specifies the maximum packet length used by the underlying SSH transport. The default is32768bytes.Normally this property should remain unchanged.
- Returns:
- the value of the
MaxPacketSizeproperty
-
setMaxPacketSize
public void setMaxPacketSize(int value)Sets theMaxPacketSizeproperty; seegetMaxPacketSize().- Parameters:
value- the new value
-
getPasswordChangeRequested
public boolean getPasswordChangeRequested()Indicates that the server rejected password authentication because the account password must be changed. This property is set byandauthenticatePw(String, String).authenticatePwPk(String, String, SshKey)When
true, call the authentication method again and pass the old and new passwords in this form:|oldPassword|newPassword|
- Returns:
- the value of the
PasswordChangeRequestedproperty (read-only)
-
getPercentDoneScale
public int getPercentDoneScale()Specifies the value representing 100% completion inPercentDoneevent callbacks. The default is100.For example, a scale of
1000provides 0.1% granularity, so a callback value of453represents 45.3% complete. Values are clamped to the range10through100000.This property applies only in environments that support event callbacks and only to operations for which progress can be measured.
- Returns:
- the value of the
PercentDoneScaleproperty
-
setPercentDoneScale
public void setPercentDoneScale(int value)Sets thePercentDoneScaleproperty; seegetPercentDoneScale().- Parameters:
value- the new value
-
getPreferIpv6
public boolean getPreferIpv6()Controls the preferred address family when DNS resolution returns both IPv4 and IPv6 addresses. The default isfalse, which prefers IPv4. Set it totrueto prefer IPv6.- Returns:
- the value of the
PreferIpv6property
-
setPreferIpv6
public void setPreferIpv6(boolean value)Sets thePreferIpv6property; seegetPreferIpv6().- Parameters:
value- the new value
-
getPreserveDate
public boolean getPreserveDate()Controls whether path-based upload and download methods preserve source timestamps on the destination. The default isfalse.Last-modified time is preserved when supported by the negotiated SFTP version and destination filesystem. SFTP v3 represents these times with whole-second precision and does not provide a creation-time attribute; creation-time preservation requires a later protocol version and server support.
This property does not apply to low-level transfers performed by opening a remote handle, reading or writing the data, and then closing the handle.
- Returns:
- the value of the
PreserveDateproperty
-
setPreserveDate
public void setPreserveDate(boolean value)Sets thePreserveDateproperty; seegetPreserveDate().- Parameters:
value- the new value
-
getProtocolVersion
public int getProtocolVersion()Contains the SFTP protocol version negotiated by, normally a value frominitializeSftp()3through6.Chilkat and the server exchange their highest supported versions, and the session uses the lower compatible version. Features unavailable in older versions are identified throughout this reference documentation.
The initial value is
0. After a successful initialization, the negotiated value can remain populated afterand during a later connection before SFTP is initialized again. Do not use this property alone to determine whether an SFTP channel is currently open.disconnect()- Returns:
- the value of the
ProtocolVersionproperty (read-only)
-
getReadDirMustMatch
Specifies a semicolon-separated list of filename patterns. When nonempty,andReadDirinclude only entries matching at least one pattern.readDirListing(String, SFtpDir)*matches zero or more characters.- Matching is case-insensitive.
?and bracket expressions such as[0-9]are not wildcard operators.- Surrounding whitespace and empty entries between semicolons are ignored.
*.xml; *.txt; *.csv
- Returns:
- the value of the
ReadDirMustMatchproperty
-
setReadDirMustMatch
Sets theReadDirMustMatchproperty; seegetReadDirMustMatch().- Parameters:
value- the new value (notnull)
-
getReadDirMustNotMatch
Specifies a semicolon-separated list of filename patterns. When nonempty,andReadDirexclude entries matching any pattern. Exclusion is applied afterreadDirListing(String, SFtpDir).getReadDirMustMatch()*matches zero or more characters.- Matching is case-insensitive.
?and bracket expressions such as[0-9]are not wildcard operators.- Surrounding whitespace and empty entries between semicolons are ignored.
*.tmp; *.bak; *.log
- Returns:
- the value of the
ReadDirMustNotMatchproperty
-
setReadDirMustNotMatch
Sets theReadDirMustNotMatchproperty; seegetReadDirMustNotMatch().- Parameters:
value- the new value (notnull)
-
getServerIdentifier
Contains the SSH server-identification string received during connection establishment. For example:SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.16
The last received identifier can remain populated after
. Usedisconnect()to determine whether the SSH transport is currently connected.getIsConnected()- Returns:
- the value of the
ServerIdentifierproperty (read-only)
-
getSessionLog
Contains the in-memory SSH/SFTP protocol log. Enable logging by settingtogetKeepSessionLog()true.This property contains log text, not a file path. Call
to clear it.clearSessionLog()- Returns:
- the value of the
SessionLogproperty (read-only)
-
getSoRcvBuf
public int getSoRcvBuf()Specifies the socket receive-buffer size. The default is4194304bytes. Normally this property should remain unchanged.When download throughput is unexpectedly low, testing a larger value may help. Values should generally be multiples of
4096.- Returns:
- the value of the
SoRcvBufproperty
-
setSoRcvBuf
public void setSoRcvBuf(int value)Sets theSoRcvBufproperty; seegetSoRcvBuf().- Parameters:
value- the new value
-
getSoSndBuf
public int getSoSndBuf()Specifies the socket send-buffer size. The default is262144bytes. Normally this property should remain unchanged.When upload throughput is unexpectedly low, testing values such as
524288or1048576may help. Values should generally be multiples of4096.- Returns:
- the value of the
SoSndBufproperty
-
setSoSndBuf
public void setSoSndBuf(int value)Sets theSoSndBufproperty; seegetSoSndBuf().- Parameters:
value- the new value
-
getSocksHostname
Specifies the SOCKS proxy hostname or IPv4 address. This property is used only whenisgetSocksVersion()4or5.- Returns:
- the value of the
SocksHostnameproperty
-
setSocksHostname
Sets theSocksHostnameproperty; seegetSocksHostname().- Parameters:
value- the new value (notnull)
-
getSocksPassword
Specifies the SOCKS5 password when username/password authentication is required. SOCKS4 does not use a password, so this property is ignored whenisgetSocksVersion()4.- Returns:
- the value of the
SocksPasswordproperty
-
setSocksPassword
Sets theSocksPasswordproperty; seegetSocksPassword().- Parameters:
value- the new value (notnull)
-
getSocksPort
public int getSocksPort()Specifies the SOCKS proxy port. The default is1080. This property is used only whenisgetSocksVersion()4or5.- Returns:
- the value of the
SocksPortproperty
-
setSocksPort
public void setSocksPort(int value)Sets theSocksPortproperty; seegetSocksPort().- Parameters:
value- the new value
-
getSocksUsername
Specifies the SOCKS proxy username. For SOCKS4 it is sent as the user ID; for SOCKS5 it is used withfor username/password authentication.getSocksPassword()- Returns:
- the value of the
SocksUsernameproperty
-
setSocksUsername
Sets theSocksUsernameproperty; seegetSocksUsername().- Parameters:
value- the new value (notnull)
-
getSocksVersion
public int getSocksVersion()Selects whether and how a SOCKS proxy is used.Value Behavior
0Do not use a SOCKS proxy. This is the default.4Connect through a SOCKS4 proxy.5Connect through a SOCKS5 proxy.- Returns:
- the value of the
SocksVersionproperty
-
setSocksVersion
public void setSocksVersion(int value)Sets theSocksVersionproperty; seegetSocksVersion().- Parameters:
value- the new value
-
getSyncCreateAllLocalDirs
public boolean getSyncCreateAllLocalDirs()Controls whethercreates empty remote directories locally. The default issyncTreeDownload(String, String, int, boolean)true.When
false, a local directory is created only when it is needed to contain a downloaded file.When
true, an empty remote directory is created locally even when no file beneath it is downloaded.- Returns:
- the value of the
SyncCreateAllLocalDirsproperty
-
setSyncCreateAllLocalDirs
public void setSyncCreateAllLocalDirs(boolean value)Sets theSyncCreateAllLocalDirsproperty; seegetSyncCreateAllLocalDirs().- Parameters:
value- the new value
-
getSyncDirectives
Specifies comma-separated directives that modifyorsyncTreeUpload(String, String, int, boolean). The default is an empty string.syncTreeDownload(String, String, int, boolean)Directive Effect
UploadIgnoreLocalOpenFailuresDuring upload synchronization, skip local files that cannot be opened, such as files held with exclusive access by another process.- Returns:
- the value of the
SyncDirectivesproperty
-
setSyncDirectives
Sets theSyncDirectivesproperty; seegetSyncDirectives().- Parameters:
value- the new value (notnull)
-
getSyncMustMatch
Specifies a semicolon-separated list of wildcard filename patterns.andsyncTreeUpload(String, String, int, boolean)transfer only files matching at least one pattern.syncTreeDownload(String, String, int, boolean)This filter applies to filenames, not directory names encountered while recursively traversing a tree.
*.xml;*.txt;*.csv
Use
*to match zero or more characters. Separate multiple patterns with semicolons.- Returns:
- the value of the
SyncMustMatchproperty
-
setSyncMustMatch
Sets theSyncMustMatchproperty; seegetSyncMustMatch().- Parameters:
value- the new value (notnull)
-
getSyncMustMatchDir
Specifies a semicolon-separated list of wildcard directory-name patterns.andsyncTreeUpload(String, String, int, boolean)enter only directories matching at least one pattern.syncTreeDownload(String, String, int, boolean)xml;txt;data_*
Use
*to match zero or more characters. Separate multiple patterns with semicolons.- Returns:
- the value of the
SyncMustMatchDirproperty
-
setSyncMustMatchDir
Sets theSyncMustMatchDirproperty; seegetSyncMustMatchDir().- Parameters:
value- the new value (notnull)
-
getSyncMustNotMatch
Specifies a semicolon-separated list of wildcard filename patterns.andsyncTreeUpload(String, String, int, boolean)skip files matching any pattern.syncTreeDownload(String, String, int, boolean)This filter applies to filenames, not directory names encountered while recursively traversing a tree.
*.tmp;*.bak;*.log
Use
*to match zero or more characters. Separate multiple patterns with semicolons.- Returns:
- the value of the
SyncMustNotMatchproperty
-
setSyncMustNotMatch
Sets theSyncMustNotMatchproperty; seegetSyncMustNotMatch().- Parameters:
value- the new value (notnull)
-
getSyncMustNotMatchDir
Specifies a semicolon-separated list of wildcard directory-name patterns.andsyncTreeUpload(String, String, int, boolean)skip directories matching any pattern.syncTreeDownload(String, String, int, boolean)temp;cache;archive_*
Use
*to match zero or more characters. Separate multiple patterns with semicolons.- Returns:
- the value of the
SyncMustNotMatchDirproperty
-
setSyncMustNotMatchDir
Sets theSyncMustNotMatchDirproperty; seegetSyncMustNotMatchDir().- Parameters:
value- the new value (notnull)
-
getTcpNoDelay
public boolean getTcpNoDelay()Controls theTCP_NODELAYsocket option. The default isfalse. Set it totrueto disable the Nagle algorithm and reduce delays when many small packets are sent.- Returns:
- the value of the
TcpNoDelayproperty
-
setTcpNoDelay
public void setTcpNoDelay(boolean value)Sets theTcpNoDelayproperty; seegetTcpNoDelay().- Parameters:
value- the new value
-
getUncommonOptions
Provides comma-separated compatibility, security, and synchronization options for uncommon scenarios. The default is an empty string and is appropriate for most applications.Keyword Effect
ForceUserAuthRsaSha1Force legacyssh-rsa/SHA-1 signatures for RSA user authentication. Set before connecting.ProtectFromVpnOn Android, bypass an installed or active VPN.NoSyncDownloadEmptyFilesPrevent empty files from being downloaded bySyncTreeDownload.no-weak-mac-algsRemove weaker SHA-1, MD5, and RIPEMD-160 MAC algorithms from the offered list.+ssh-hmac-etmRe-enable OpenSSH Encrypt-then-MAC algorithms disabled by default as a Terrapin mitigation.+chacha20-poly1305@openssh.comRe-enablechacha20-poly1305@openssh.com, disabled by default as a Terrapin mitigation.- Returns:
- the value of the
UncommonOptionsproperty
-
setUncommonOptions
Sets theUncommonOptionsproperty; seegetUncommonOptions().- Parameters:
value- the new value (notnull)
-
getUploadChunkSize
public int getUploadChunkSize()Specifies the chunk size, in bytes, used byanduploadFile(String, String). The default isuploadFileByName(String, String)32000.If an upload fails because the local operating system aborts the connection, try a smaller value such as
4096. Smaller chunks can reduce throughput.- Returns:
- the value of the
UploadChunkSizeproperty
-
setUploadChunkSize
public void setUploadChunkSize(int value)Sets theUploadChunkSizeproperty; seegetUploadChunkSize().- Parameters:
value- the new value
-
getUserAuthBanner
Contains a user-authentication banner received from the server. Check this property afteror another authentication attempt and display it to the user when appropriate.startKeyboardAuth(String)When no banner is available, the property returns an empty string.
- Returns:
- the value of the
UserAuthBannerproperty
-
setUserAuthBanner
Sets theUserAuthBannerproperty; seegetUserAuthBanner().- Parameters:
value- the new value (notnull)
-
getUtcMode
public boolean getUtcMode()Controls the time zone used by date/time getters. Whentrue, returned values are expressed in UTC. Whenfalse(the default), returned values are converted to the local time zone.UtcMode = _FALSE_: Fri, 21 Nov 1997 09:55:06 -0600 UtcMode = _TRUE_: Fri, 21 Nov 1997 15:55:06 GMT
- Returns:
- the value of the
UtcModeproperty
-
setUtcMode
public void setUtcMode(boolean value)Sets theUtcModeproperty; seegetUtcMode().- Parameters:
value- the new value
-
getXferByteCount
public long getXferByteCount()Contains the current transfer byte count for an upload or download in progress. An application can read this property while an asynchronous transfer is running.For
andsyncTreeUpload(String, String, int, boolean), the value is cumulative across all files processed by the operation. UsesyncTreeDownload(String, String, int, boolean)when a 64-bit count is required.getXferByteCount64()- Returns:
- the value of the
XferByteCountproperty (read-only)
-
getXferByteCount64
public long getXferByteCount64()Contains the current 64-bit transfer byte count for an upload or download in progress. An application can read this property while an asynchronous transfer is running.For
andsyncTreeUpload(String, String, int, boolean), the value is cumulative across all files processed by the operation.syncTreeDownload(String, String, int, boolean)- Returns:
- the value of the
XferByteCount64property (read-only)
-
authenticatePk
Authenticates the connected SSH session using public-key authentication.usernameidentifies the server account, andprivateKeymust contain the corresponding private key. The matching public key must already be authorized for that account on the server.Call
first. After a failure, inspectconnect(String, int)andgetAuthFailReason()LastErrorText.- Parameters:
username- theusernameargument (notnull)privateKey- theprivateKeyargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
authenticatePw
Authenticates the connected SSH session usingloginandpassword.1. Connect 2. AuthenticatePw or AuthenticatePk 3. InitializeSftp
If the server requests a password change, see
. After a failure, inspectgetPasswordChangeRequested()andgetAuthFailReason()LastErrorText.A rejected password does not necessarily close the SSH connection. The application may retry authentication on the same connected session. After a later success, an older
value can remain populated.getAuthFailReason()- Parameters:
login- theloginargument (notnull)password- thepasswordargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
authenticatePwPk
Authenticates with a server that requires both a password and a private key.usernameidentifies the account,passwordsupplies the password, andprivateKeysupplies the private key.Most servers require either password or public-key authentication rather than both. After a failure, inspect
andgetAuthFailReason()LastErrorText.- Parameters:
username- theusernameargument (notnull)password- thepasswordargument (notnull)privateKey- theprivateKeyargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
authenticateSecPw
- Parameters:
login- theloginargument (notnull)password- thepasswordargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
authenticateSecPwPk
Works like, but receivesauthenticatePwPk(String, String, SshKey)usernameandpasswordinSecureStringobjects.privateKeysupplies the private key.- Parameters:
username- theusernameargument (notnull)password- thepasswordargument (notnull)privateKey- theprivateKeyargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
clearCache
public void clearCache()Clears the internal remote file-attribute cache used whenisgetEnableCache()true. -
clearSessionLog
public void clearSessionLog()Clears the in-memory text stored in.getSessionLog() -
closeHandle
Closes the remote file or directory handle specified byhandle. The handle must have been returned byoropenFile(String, String, String).openDir(String)Handles are specific to one initialized SFTP session. Close each handle exactly once. Closing an empty, invalid, or already-closed handle returns
false. A handle must never be reused after disconnecting or replacing the connection.- Parameters:
handle- thehandleargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
connect
Establishes an SSH connection todomainNameon TCP portport. The host may be a DNS name or numeric IPv4 or IPv6 address; SSH servers commonly listen on port22.A successful connection establishes the SSH transport only. Next call an authentication method, then call
.initializeSftp()1. Connect 2. AuthenticatePw, AuthenticatePk, or another authentication method 3. InitializeSftp 4. Perform SFTP operations
Supported negotiation algorithms include:
Category Algorithms
Host key
ssh-ed25519,rsa-sha2-256,rsa-sha2-512,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dssKey exchange
curve25519-sha256,curve25519-sha256@libssh.org, NIST ECDH, Diffie-Hellman group 1/14/16/18, and group-exchange SHA-1/SHA-256Ciphers AES CTR/CBC/GCM, Twofish CBC, Blowfish CBC, and optionally
chacha20-poly1305@openssh.comMAC SHA-2, SHA-1, RIPEMD-160, MD5, and optionally OpenSSH Encrypt-then-MAC variants
Compression
none,zlib, andzlib@openssh.comConnection failures can occur before SSH negotiation because of firewalls, endpoint security, routing, network ACLs, proxy configuration, or server policy.Calling while connected: A new successful
Connectreplaces the existing SSH connection. The previous SFTP subsystem and all handles from it are no longer usable. Authenticate and callfor the new connection.initializeSftp()- Parameters:
domainName- thedomainNameargument (notnull)port- theportargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
connectThroughSsh
Connects tohostnameonportthrough the already connected and authenticatedSshobject insshConn.application → first SSH server → destination SSH/SFTP server
After this method succeeds, authenticate separately with the destination server and call
InitializeSftp. All destination traffic is carried through the first SSH connection.- Parameters:
sshConn- thesshConnargument (notnull)hostname- thehostnameargument (notnull)port- theportargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
continueKeyboardAuth
Continues keyboard-interactive authentication by submittingresponsefor the prompts returned by.startKeyboardAuth(String)For a single prompt, pass the response text directly. For multiple prompts, pass XML in this form:
<response> <response1>response to first prompt</response1> <response2>response to second prompt</response2> ... </response>
The returned XML indicates authentication success, authentication failure, or another
infoRequestcontaining additional prompts.<success>success message</success> <error>error message</error>
- Parameters:
response- theresponseargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
copyFileAttr
Copies supported timestamps and attributes from the local file atlocalFilenameto the remote item identified byremoteFilename.Set
isHandletotruewhenremoteFilenamecontains an open SFTP handle; otherwise set it tofalsefor a remote path.Negotiated SFTP version Attributes copied
SFTP v3 and earlier Last-modified time and last-access time
SFTP v4 and v5 Last-modified time, last-access time, and creation time
SFTP v6 and later The preceding timestamps plus read-only, hidden, archive, compressed, and encrypted flags
The remote server and filesystem determine whether all requested attributes can be applied. Last-access time may change when the server accesses the file, and compressed or encrypted flags may not have the same effect on every server.
- Parameters:
localFilename- thelocalFilenameargument (notnull)remoteFilename- theremoteFilenameargument (notnull)isHandle- theisHandleargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
createDir
Creates the remote directory specified bypath. Parent directories are not necessarily created automatically.- Parameters:
path- thepathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
disconnect
public void disconnect()Closes the current SSH/SFTP connection. All remote file and directory handles from that session become invalid and must not be reused.The object remains reusable. A later session must call
, authenticate again, and callconnect(String, int)before performing SFTP operations.initializeSftp()Some properties retain values from the previous session after disconnect, including the negotiated protocol version, server identifier, and last SFTP status. Treat these as historical values rather than evidence of a live session.
-
downloadBd
Downloads the remote file atremoteFilePathand appends its bytes tobinData.Existing data in
binDatais preserved. Clear it first when replacement rather than append behavior is required.- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)binData- thebinDataargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
downloadFile
Streams the remote file identified byhandleto the local filesystem pathtoFilename. The handle must have been returned by.openFile(String, String, String)The transfer is streamed and is not limited by available memory. Close the remote handle when the download is complete.
This method downloads the entire remote file beginning at byte offset
0. It does not begin at the handle's current sequential read position.- Parameters:
handle- thehandleargument (notnull)toFilename- thetoFilenameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
downloadFileByName
Downloads the remote file atremoteFilePathto the local filesystem pathlocalFilePath.When
isgetPreserveDate()true, Chilkat preserves the remote file's last-modified time.An absolute remote path begins with
/and is relative to the server filesystem root. A relative path is interpreted relative to the authenticated user's home directory.If the local destination file exists, it is truncated before the download.- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)localFilePath- thelocalFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
downloadSb
Downloads the remote file atremoteFilePath, decodes it usingcharset, and appends the text tosb.Existing text in
sbis preserved. Clear it first when replacement rather than append behavior is required.- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)charset- thecharsetargument (notnull)sb- thesbargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
eof
Returnstruewhen the most recent read forhandlereceived the SFTP end-of-file status.Reading exactly through the final byte does not set EOF immediately. The next read returns successfully with zero bytes, sets
togetLastStatusCode()SSH_FX_EOF, and causes this method to returntrue.An empty, malformed, or already-closed handle can also cause this method to return
true. Useand the read method's result to distinguish a normal EOF from a handle or read failure.lastReadFailed(String)- Parameters:
handle- thehandleargument (notnull)- Returns:
- the result; this method never throws
ChilkatException
-
fileExists
Checks the remote item atremotePath. WhenfollowLinksistrue, a symbolic link is followed and the target type is returned.Return value Meaning
-1Unable to determine the result. InspectLastErrorText.0The path does not exist.1A regular file exists.2A directory exists.3A symbolic link exists. This is possible only whenfollowLinksisfalse.4A special filesystem entry exists.5An entry of unknown type exists.6A socket exists.7A character device exists.8A block device exists.9A FIFO exists.Positive values correspond to SFTP filesystem entry types. Some types are platform-dependent.For a dangling symbolic link,
followLinks =returnsfalse3for the link itself, whilefollowLinks =returnstrue0because the target does not exist.- Parameters:
remotePath- theremotePathargument (notnull)followLinks- thefollowLinksargument- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
fsync
Requests that the server flush pending data for the open file identified byhandleto stable storage.This method uses the OpenSSH
fsync@openssh.comextension and succeeds only when the server supports that extension.- Parameters:
handle- thehandleargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getFileCreateTimeStr
Returns the remote file's creation date and time.pathOrHandlemay contain a remote path or a handle returned by. SetopenFile(String, String, String)bIsHandletotruefor a handle andfalsefor a path.When
bFollowLinksistrue, the server follows a symbolic link and returns metadata for its target.SFTP v3 and earlier do not provide a file creation time.
The result is an RFC 822 formatted string, for example
Fri, 21 Nov 1997 09:55:06 -0600.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bFollowLinks- thebFollowLinksargumentbIsHandle- thebIsHandleargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getFileGroup
Returns the remote file's group ownership.pathOrHandlemay contain a remote path or a handle returned by. SetopenFile(String, String, String)bIsHandletotruefor a handle andfalsefor a path.When
bFollowLinksistrue, the server follows a symbolic link and returns metadata for its target.With SFTP v3 and earlier, the result is the decimal numeric GID because textual group names are not supported.
- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bFollowLinks- thebFollowLinksargumentbIsHandle- thebIsHandleargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getFileLastAccessStr
Returns the remote file's last-access date and time.pathOrHandlemay contain a remote path or a handle returned by. SetopenFile(String, String, String)bIsHandletotruefor a handle andfalsefor a path.When
bFollowLinksistrue, the server follows a symbolic link and returns metadata for its target.The result is an RFC 822 formatted string, for example
Fri, 21 Nov 1997 09:55:06 -0600.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bFollowLinks- thebFollowLinksargumentbIsHandle- thebIsHandleargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getFileLastModifiedStr
Returns the remote file's last-modified date and time.pathOrHandlemay contain a remote path or a handle returned by. SetopenFile(String, String, String)bIsHandletotruefor a handle andfalsefor a path.When
bFollowLinksistrue, the server follows a symbolic link and returns metadata for its target.The result is an RFC 822 formatted string, for example
Fri, 21 Nov 1997 09:55:06 -0600.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bFollowLinks- thebFollowLinksargumentbIsHandle- thebIsHandleargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getFileOwner
Returns the remote file's owner.pathOrHandlemay contain a remote path or a handle returned by. SetopenFile(String, String, String)bIsHandletotruefor a handle andfalsefor a path.When
bFollowLinksistrue, the server follows a symbolic link and returns metadata for its target.With SFTP v3 and earlier, the result is the decimal numeric UID because textual owner names are not supported.
- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bFollowLinks- thebFollowLinksargumentbIsHandle- thebIsHandleargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getFilePermissions
Returns the remote item's complete POSIX mode value.pathOrHandlemay contain a remote path or a handle returned by. SetopenFile(String, String, String)bIsHandletotruefor a handle andfalsefor a path. WhenbFollowLinksistrue, the server follows a symbolic link and returns metadata for its target.The returned integer includes both the file-type bits and permission bits. For example:
Regular file, mode 0664: octal 0100664, decimal 33204 Regular file, mode 0600: octal 0100600, decimal 33152 Regular file, mode 0644: octal 0100644, decimal 33188
Mask with octal
07777to obtain permission and special bits, or0777for only the traditional owner/group/other read, write, and execute bits. Seeto change the permissions.setPermissions(String, boolean, int)- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bFollowLinks- thebFollowLinksargumentbIsHandle- thebIsHandleargument- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
getFileSize32
Returns the remote file's size in bytes as a 32-bit integer.pathOrHandlemay contain a remote path or a handle returned by. SetopenFile(String, String, String)bIsHandletotruefor a handle andfalsefor a path.When
bFollowLinksistrue, the server follows a symbolic link and returns metadata for its target.Returns
-1when the size cannot be represented as a 32-bit integer. UseGetFileSize64orGetFileSizeStrfor large files.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bFollowLinks- thebFollowLinksargumentbIsHandle- thebIsHandleargument- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
getFileSize64
Returns the remote file's size in bytes as a 64-bit integer.pathOrHandlemay contain a remote path or a handle returned by. SetopenFile(String, String, String)bIsHandletotruefor a handle andfalsefor a path.When
bFollowLinksistrue, the server follows a symbolic link and returns metadata for its target.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bFollowLinks- thebFollowLinksargumentbIsHandle- thebIsHandleargument- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
getFileSizeStr
Returns the remote file's size in bytes as a decimal string.pathOrHandlemay contain a remote path or a handle returned by. SetopenFile(String, String, String)bIsHandletotruefor a handle andfalsefor a path.When
bFollowLinksistrue, the server follows a symbolic link and returns metadata for its target.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bFollowLinks- thebFollowLinksargumentbIsHandle- thebIsHandleargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getHostKeyFP
Returns the connected server's host-key fingerprint usinghashAlg. Common choices includeSHA256,SHA384,SHA512,SHA1, andMD5.includeKeyType includeHashName Example format
truetruessh-rsa SHA256:L7sQgnpnoBwRoyIYXAFBs8SdSnwtyYmhXs1p/mQDK...truefalsessh-rsa L7sQgnpnoBwRoyIYXAFBs8SdSnwtyYmhXs1p/mQDK...falsetrueSHA256:L7sQgnpnoBwRoyIYXAFBs8SdSnwtyYmhXs1p/mQDK...falsefalseL7sQgnpnoBwRoyIYXAFBs8SdSnwtyYmhXs1p/mQDK...For server identity verification, compare a SHA-256 fingerprint with a value obtained from a trusted source before sending credentials.
- Parameters:
hashAlg- thehashAlgargument (notnull)includeKeyType- theincludeKeyTypeargumentincludeHashName- theincludeHashNameargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getLastJsonData
Populatesjsonwith supplemental details produced by the most recent method when such details are available. Many methods do not produce additional JSON information.- Parameters:
json- thejsonargument (notnull)
-
getSyncedFiles
Appends tostrTabthe relative paths processed by the most recentorsyncTreeUpload(String, String, int, boolean)operation.syncTreeDownload(String, String, int, boolean)For downloads, entries can include local directories that were created. Directory paths end with
/so they can be distinguished from file paths.Existing entries in
strTabare preserved.ClearstrTabfirst when only the latest synchronization results are wanted. Downloaded directory entries are reported with a trailing/; uploaded directory entries are reported without one.- Parameters:
strTab- thestrTabargument (notnull)
-
hardLink
Creates a hard link fromnewPathto the existing remote file atoldPath.This method uses the OpenSSH
hardlink@openssh.comextension and succeeds only when the server supports that extension.A successful hard link refers to the same underlying file. Modifying the existing file through either path changes the content observed through the other path.- Parameters:
oldPath- theoldPathargument (notnull)newPath- thenewPathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
initializeSftp
public void initializeSftp()Opens the SFTP subsystem and negotiates the SFTP protocol version. Call this method after connecting and authenticating.1. Connect 2. AuthenticatePw, AuthenticatePk, or another authentication method 3. InitializeSftp
After success, read
to determine the negotiated SFTP version.getProtocolVersion()If opening the SFTP channel fails, inspect
,getInitializeFailCode(), andgetInitializeFailReason()LastErrorText.Call this method only once for a given SSH connection. A second call on the same connection returnsfalse. After disconnecting or replacing the connection, authenticate the new connection and call this method again.- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
lastReadFailed
Returnstrueif the most recent read associated withhandlefailed; otherwise returnsfalse.A normal end-of-file is not a read failure: the EOF read succeeds, returns zero bytes, and this method returns
false. For an empty, malformed, or already-closed handle, this method returnstrue.- Parameters:
handle- thehandleargument (notnull)- Returns:
- the result; this method never throws
ChilkatException
-
lastReadNumBytes
Returns the number of bytes received by the most recent read associated withhandle.The initial value for a newly opened handle is
0. A normal EOF read and a failed read report0.- Parameters:
handle- thehandleargument (notnull)- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
openDir
Opens the remote directory specified bypathand returns a handle for reading its entries.handle = OpenDir(path) ReadDirListing(handle, dirObj) CloseHandle(handle)
Remote paths use
/as the separator. A path beginning with/is absolute; a relative path is interpreted relative to the authenticated user's home directory. An empty path refers to that default directory.This method does not change a working directory. SFTP is not FTP and has no persistent current-directory command.
- Parameters:
path- thepathargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
openFile
Opens or creates the remote file atremotePathand returns a handle for subsequent read or write operations. Close the handle withCloseHandlewhen finished.accessmust bereadOnly,writeOnly, orreadWrite.createDispositionis a comma-separated list. It must contain exactly one primary disposition:Primary disposition Behavior
createNewCreate a new file; fail if it already exists.createTruncateCreate a new file, or open and truncate an existing file.openExistingOpen an existing file; fail if it does not exist.openOrCreateOpen the file if it exists, otherwise create it.truncateExistingOpen and truncate an existing file; fail if it does not exist.Additional optional keywords are:
Option Behavior
appendDataWrite at the end of the file. Appends are not guaranteed to be atomic.appendDataAtomicAppend atomically so concurrent appenders do not collide. SFTP v5 or later.textModeRequest server text-mode processing and canonical newline conversion. SFTP v5 or later.blockReadRequest exclusive read access. SFTP v5 or later.blockWriteRequest exclusive write access. SFTP v5 or later.blockDeletePrevent deletion while the handle is open. SFTP v5 or later.blockAdvisoryMake the requested block modes advisory. SFTP v5 or later.noFollowFail if the final path component is a symbolic link. SFTP v5 or later.deleteOnCloseRequest deletion when the last handle is closed. SFTP v5 or later.accessAuditAlarmInfoRequest privileges needed to read or write AUDIT or ALARM ACL entries. SFTP v5 or later.accessBackupRequest backup/restore privileges that may bypass normal access checks. SFTP v5 or later.backupStreamRead or write a server-specific backup stream. SFTP v5 or later.Options marked SFTP v5 or later require
to begetForceV3()falseand a negotiatedof at leastgetProtocolVersion()5.An absolute remote path begins with/. A relative path is interpreted from the authenticated user's home directory. Some servers require a filename in the home directory to be written as./filename.Use only documented values: Some servers or Chilkat versions may tolerate an unknown access value, an unknown option, or conflicting primary dispositions, but the resulting behavior is unspecified. Supply one documented access value and exactly one primary disposition.appendDataforces writes to the end of the file, including explicit-offset writes. By itself it opens an existing file but does not create a missing file; combine it with an appropriate primary disposition when creation is required. Options defined for SFTP v5 or later must not be assumed to take effect when an older version is negotiated, even if the open request succeeds.- Parameters:
remotePath- theremotePathargument (notnull)access- theaccessargument (notnull)createDisposition- thecreateDispositionargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
readDirListing
Reads all remaining directory entries fromhandle, which must have been returned by, and stores them inopenDir(String)dirObj. Entries are returned in server order; Chilkat does not sort the listing.After end-of-directory has been reached, another call on the same handle returns
true, adds no entries, and setstogetLastStatusCode()SSH_FX_EOF.This method does not clear
dirObj. Use a new or clearedSFtpDirobject when an empty result must replace an earlier listing. Close the directory handle when finished.- Parameters:
handle- thehandleargument (notnull)dirObj- thedirObjargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
readFileBd
Reads up tonumBytesbytes from the current position of the remote file identified byhandleand appends them tobd. The handle must have been returned by.openFile(String, String, String)Fewer bytes can be read when end-of-file is reached. Repeat the call until
Eof(handle)returnstrueto read the entire file incrementally.This method shares the handle's sequential read position with
andReadFileBytes. Existing bytes inreadFileText(String, int, String)bdare preserved.- Parameters:
handle- thehandleargument (notnull)numBytes- thenumBytesargumentbd- thebdargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
readFileText
Reads up tonumBytesbytes from the current position ofhandle, decodes the bytes usingcharset, and returns the resulting text.See Supported Charsets.
The requested size is measured in bytes, not characters. With a multibyte encoding such as UTF-8 or Shift_JIS, the final character can be split across calls. For robust streaming, read raw bytes and decode with application-maintained state.Multibyte boundaries: Chilkat does not retain an incomplete multibyte character between calls. If
numBytesends in the middle of a UTF-8 sequence, the first returned string ends with the incomplete bytes and the next call begins with the remaining bytes. Choose byte counts that end on character boundaries, or read bytes and perform streaming decoding in the application.- Parameters:
handle- thehandleargument (notnull)numBytes- thenumBytesargumentcharset- thecharsetargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
readFileText32
Reads up tonumBytesbytes fromhandleat the 32-bit byteoffset, decodes the bytes usingcharset, and returns the resulting text.See Supported Charsets.
The requested size is measured in bytes, not characters. With a multibyte encoding such as UTF-8 or Shift_JIS, the final character can be split across calls. For robust streaming, read raw bytes and decode with application-maintained state.
- Parameters:
handle- thehandleargument (notnull)offset- theoffsetargumentnumBytes- thenumBytesargumentcharset- thecharsetargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
readFileText64
Reads up tonumBytesbytes fromhandleat the 64-bit byteoffset, decodes the bytes usingcharset, and returns the resulting text.See Supported Charsets.
The requested size is measured in bytes, not characters. With a multibyte encoding such as UTF-8 or Shift_JIS, the final character can be split across calls. For robust streaming, read raw bytes and decode with application-maintained state.
- Parameters:
handle- thehandleargument (notnull)offset- theoffsetargumentnumBytes- thenumBytesargumentcharset- thecharsetargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
readFileText64s
Reads up tonumBytesbytes fromhandleat the byte offset supplied as decimal stringoffset, decodes the bytes usingcharset, and returns the resulting text.See Supported Charsets.
The requested size is measured in bytes, not characters. With a multibyte encoding, the final character can be split across calls.
- Parameters:
handle- thehandleargument (notnull)offset- theoffsetargument (notnull)numBytes- thenumBytesargumentcharset- thecharsetargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
readLink
Returns the target path stored in the symbolic link at remotepath.The returned value is the target string stored in the link. It is not automatically canonicalized and can be relative, absolute, or refer to a nonexistent target.
- Parameters:
path- thepathargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
realPath
Asks the server to canonicalizeoriginalPathand returns the resulting absolute remote path.For SFTP v5 or later,
composePathmay optionally modify or extend the original path; pass an empty string when no composition is needed. IfcomposePathis absolute, it replacesoriginalPath.SFTP v3 and v4 do not support path composition. On those versions,
composePathis ignored and the method canonicalizes onlyoriginalPath.- Parameters:
originalPath- theoriginalPathargument (notnull)composePath- thecomposePathargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
removeDir
Deletes the remote directory specified bypath.Most SFTP servers require the directory to be empty before it can be removed.
- Parameters:
path- thepathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
removeFile
Deletes the remote file specified byfilename.- Parameters:
filename- thefilenameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
renameFileOrDir
Renames or moves a remote file or directory fromoldPathtonewPath.oldPath: someDirA/filename newPath: someDirB/abc/xyz/filename
- Parameters:
oldPath- theoldPathargument (notnull)newPath- thenewPathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
resumeDownloadFileByName
Resumes downloadingremoteFilePathto the local filesystem pathlocalFilePath. Chilkat uses only the existing local file size as the remote starting offset.- If the local file is missing or empty, a normal download is performed.
- If it is smaller, the remaining remote bytes are appended after the existing local length.
- If it is the same size or larger, the method treats the download as complete and does not truncate or verify the local content.
Important: The existing local bytes are not compared with the remote source. Before resuming, the application must ensure that the local file is the correct prefix of the remote file.
- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)localFilePath- thelocalFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
resumeUploadFileByName
Resumes uploading the local file atlocalFilePathtoremoteFilePath. Chilkat uses only the existing remote file size as the local starting offset.- If the remote file is missing or empty, a normal upload is performed.
- If it is smaller, the remaining local bytes are appended after the existing remote length.
- If it is the same size or larger, the method treats the upload as complete and does not truncate or verify the remote content.
Important: The existing remote bytes are not compared with the local source. Before resuming, the application must ensure that the remote file is the correct prefix of the local file.
- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)localFilePath- thelocalFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
sendIgnore
public void sendIgnore()Sends an SSHIGNOREmessage. No SFTP file handle or channel is required.The server does not send a reply, but a successful send helps verify that the SSH connection is still writable.
- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setAllowedAlgorithms
Configures the exact set of SSH algorithms permitted for subsequent connections using the settings injson.Call this method before
Connect. The connection fails when no mutually supported algorithm remains in a required category.- Parameters:
json- thejsonargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setCreateDt
Sets the remote file's creation date and time.pathOrHandlemay contain a remote path or an open handle. SetisHandletotruefor a handle andfalsefor a path.SFTP v3 and earlier do not support setting creation time.
createDateTimesupplies the new value.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)isHandle- theisHandleargumentcreateDateTime- thecreateDateTimeargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setCreateTimeStr
Sets the remote file's creation date and time.pathOrHandlemay contain a remote path or an open handle. SetbIsHandletotruefor a handle andfalsefor a path.Pass the value in
dateTimeStras an RFC 822 formatted string, for exampleFri, 21 Nov 1997 09:55:06 -0600.SFTP v3 and earlier do not support setting creation time.
- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bIsHandle- thebIsHandleargumentdateTimeStr- thedateTimeStrargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setLastAccessDt
Sets the remote file's last-access date and time.pathOrHandlemay contain a remote path or an open handle. SetisHandletotruefor a handle andfalsefor a path.accessDateTimesupplies the new value.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)isHandle- theisHandleargumentaccessDateTime- theaccessDateTimeargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setLastAccessTimeStr
Sets the remote file's last-access date and time.pathOrHandlemay contain a remote path or an open handle. SetbIsHandletotruefor a handle andfalsefor a path.Pass the value in
dateTimeStras an RFC 822 formatted string, for exampleFri, 21 Nov 1997 09:55:06 -0600.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bIsHandle- thebIsHandleargumentdateTimeStr- thedateTimeStrargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setLastModifiedDt
Sets the remote file's last-modified date and time.pathOrHandlemay contain a remote path or an open handle. SetisHandletotruefor a handle andfalsefor a path.modifiedDateTimesupplies the new value.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)isHandle- theisHandleargumentmodifiedDateTime- themodifiedDateTimeargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setLastModifiedTimeStr
Sets the remote file's last-modified date and time.pathOrHandlemay contain a remote path or an open handle. SetbIsHandletotruefor a handle andfalsefor a path.Pass the value in
dateTimeStras an RFC 822 formatted string, for exampleFri, 21 Nov 1997 09:55:06 -0600.When SFTP v3 is negotiated, the stored timestamp has whole-second precision.
- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)bIsHandle- thebIsHandleargumentdateTimeStr- thedateTimeStrargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setOwnerAndGroup
Sets the owner and group of the remote item identified bypathOrHandle. SetisHandletotruefor an open handle andfalsefor a remote path.ownerandgroupsupply the new textual owner and group values.SFTP v3 and earlier do not support textual owner and group names.
- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)isHandle- theisHandleargumentowner- theownerargument (notnull)group- thegroupargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setPermissions
Sets the POSIX permission bits for the remote item identified bypathOrHandle. SetisHandletotruefor an open handle andfalsefor a remote path.Pass the permission bits, not the file-type bits. In languages supporting octal integer literals, common values include
0600,0644, and0755. Their decimal equivalents are384,420, and493.After setting permissions,
returns the complete mode, including the file-type bits. For example, settinggetFilePermissions(String, boolean, boolean)0644on a regular file can subsequently return0100644.- Parameters:
pathOrHandle- thepathOrHandleargument (notnull)isHandle- theisHandleargumentpermissions- thepermissionsargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
startKeyboardAuth
Begins keyboard-interactive authentication forloginand returns XML describing the server's prompts.<infoRequest numPrompts="N"> <name>name_string</name> <instruction>instruction_string</instruction> <prompt1 echo="1_or_0">prompt_string</prompt1> ... <promptN echo="1_or_0">prompt_string</promptN> </infoRequest>
The
echoattribute indicates whether the response may be displayed while entered. A value of0normally identifies secret input such as a password.If authentication immediately succeeds or fails, the result has one of these forms:
<success>success message</success> <error>error message</error>
- Parameters:
login- theloginargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
symLink
Creates a symbolic link on the server.oldPathidentifies the link target andnewPathidentifies the new symbolic-link path.The server's SFTP implementation determines path interpretation and whether symbolic links are permitted.
- Parameters:
oldPath- theoldPathargument (notnull)newPath- thenewPathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
syncTreeDownload
Synchronizes files from the remote directoryremoteRootto the local filesystem directorylocalRoot.Mode Behavior
0Download all files.1Download files that do not exist locally.2Download files that are newer remotely or missing locally.3Download only files that are newer remotely; do not download missing local files.5Download files that are missing locally or differ in size.6Mode 5 plus files that are newer remotely.99Do not download; delete remote files that do not exist locally.Set
recursetotrueto descend into subdirectories. An absolute remote path begins with/; a relative path is interpreted from the authenticated user's home directory.Use
after the operation to retrieve the relative paths that were downloaded or created.getSyncedFiles(StringTable)With
set togetSyncCreateAllLocalDirs()true, mode0creates empty remote directories locally. Mode1downloads only missing local files and preserves existing local files. Mode99deletes files from the remote tree that are absent locally; it does not delete extra local files.- Parameters:
remoteRoot- theremoteRootargument (notnull)localRoot- thelocalRootargument (notnull)mode- themodeargumentrecurse- therecurseargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
syncTreeUpload
Synchronizes files from the local filesystem directorylocalBaseDirto the remote directoryremoteBaseDir.Mode Behavior
0Upload all files.1Upload files that do not exist remotely.2Upload files that are newer locally or missing remotely.3Upload only files that are newer locally; do not upload missing remote files.4Upload files that are missing remotely or differ in size.5Mode 4 plus files that are newer locally.Set
bRecursetotrueto descend into subdirectories. An absolute remote path begins with/; a relative path is interpreted from the authenticated user's home directory.Use
after the operation to retrieve the relative paths that were uploaded.getSyncedFiles(StringTable)Mode
0also creates empty remote directories. Mode1uploads only missing files and does not replace an existing remote file merely because the local file is newer; use mode2for missing-or-newer behavior. The filename and directory filters are applied during recursive traversal.- Parameters:
localBaseDir- thelocalBaseDirargument (notnull)remoteBaseDir- theremoteBaseDirargument (notnull)mode- themodeargumentbRecurse- thebRecurseargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
uploadBd
Uploads all bytes inbinDatato the remote file atremoteFilePath.If the destination exists, it is truncated before the bytes are uploaded.
- Parameters:
binData- thebinDataargument (notnull)remoteFilePath- theremoteFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
uploadFile
Streams the local filesystem file atfromLocalFilePathto the remote file identified byhandle. The handle must have been returned by.openFile(String, String, String)Close the remote handle when the upload is complete.
The upload begins at the handle's current sequential write position. Existing bytes before that position are preserved unless the file was truncated when opened.
- Parameters:
handle- thehandleargument (notnull)fromLocalFilePath- thefromLocalFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
uploadFileByName
Uploads the local filesystem file atlocalFilePathtoremoteFilePath.When
isgetPreserveDate()true, Chilkat preserves the local file's last-modified time on the remote file.An absolute remote path begins with
/and is relative to the server filesystem root. A relative path is interpreted relative to the authenticated user's home directory.If the destination exists, it is truncated before the upload. A zero-byte local file creates or truncates the remote file to zero bytes. Missing remote parent directories are not created automatically.- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)localFilePath- thelocalFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
uploadSb
Encodes the text insbusingcharsetand uploads it toremoteFilePath.Set
includeBomtotrueto prepend a byte-order mark when the selected encoding supports one.If the destination exists, it is truncated before the text is uploaded. For
utf-8, settingincludeBomtotrueprepends the three bytesEF BB BF; setting it tofalseomits them.- Parameters:
sb- thesbargument (notnull)remoteFilePath- theremoteFilePathargument (notnull)charset- thecharsetargument (notnull)includeBom- theincludeBomargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
writeFileBd
Appends all bytes inbdto the remote file identified byhandle. The handle must have been returned by.openFile(String, String, String)- Parameters:
handle- thehandleargument (notnull)bd- thebdargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
writeFileText
EncodestextDatausingcharsetand writes the resulting bytes at the current sequential write position forhandle.The position is maintained by Chilkat for the handle. Opening an existing file with
openOrCreatepositions sequential writes at the current end of the file. An explicit-offset write can change the position used by the next sequential write. When the file was opened withappendData, writes are forced to the end.See Supported Charsets.
No byte-order mark or line ending is added unless it is present in the supplied text or produced by the selected encoding.
- Parameters:
handle- thehandleargument (notnull)charset- thecharsetargument (notnull)textData- thetextDataargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
writeFileText32
EncodestextDatausingcharsetand writes the resulting bytes tohandleat the 32-bit byte offsetoffset32.After a successful explicit-offset write, the next sequential write begins immediately after the bytes written by this call. If the file was opened with
appendData, the server appends and the explicit offset does not control placement.See Supported Charsets.
offset32must be nonnegative. A negative value can be interpreted as a very large unsigned offset. Writing beyond end-of-file can create a sparse file; whether the gap is sparse is determined by the server filesystem.No byte-order mark or line ending is added unless it is present in the supplied text or produced by the selected encoding.- Parameters:
handle- thehandleargument (notnull)offset32- theoffset32argumentcharset- thecharsetargument (notnull)textData- thetextDataargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
writeFileText64
EncodestextDatausingcharsetand writes the resulting bytes tohandleat the 64-bit byte offsetoffset64.See Supported Charsets.
No byte-order mark or line ending is added unless it is present in the supplied text or produced by the selected encoding.
- Parameters:
handle- thehandleargument (notnull)offset64- theoffset64argumentcharset- thecharsetargument (notnull)textData- thetextDataargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
writeFileText64s
EncodestextDatausingcharsetand writes the resulting bytes tohandleat the byte offset supplied as decimal stringoffset64.See Supported Charsets.
No byte-order mark or line ending is added unless it is present in the supplied text or produced by the selected encoding.
- Parameters:
handle- thehandleargument (notnull)offset64- theoffset64argument (notnull)charset- thecharsetargument (notnull)textData- thetextDataargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setProgressListener
Installs the listener that receives this object's progress events (abortCheck,percentDone,progressInfo) during its long-running methods; replaces any listener or lambda installed before;nullremoves it.- Parameters:
listener- the listener, ornull- Throws:
IllegalStateException- if called from inside one of this object's own callbacks
-
getProgressListener
Returns the installed listener, ornull.- Returns:
- the listener installed with
setProgressListener(ProgressListener)or one of theon...methods
-
onAbortCheck
Installs a listener whose only callback isabortCheck: called everyHeartbeatMsmilliseconds during a long-running method; returntrueto abort it. Replaces any listener installed before.- Parameters:
callback- the callback, ornullto remove the listener
-
onPercentDone
Installs a listener whose only callback ispercentDone: called with the completion percentage (0..100) as a long-running method progresses; returntrueto abort it. Replaces any listener installed before.- Parameters:
callback- the callback, ornullto remove the listener
-
onProgressInfo
Installs a listener whose only callback isprogressInfo: called with a name/value pair of progress information as a long-running method proceeds. Replaces any listener installed before.- Parameters:
callback- the callback, ornullto remove the listener
-