public class SmbConnection extends Object implements AutoCloseable
| Constructor and Description |
|---|
SmbConnection(String serverName,
String shareName,
com.hierynomus.smbj.auth.AuthenticationContext authenticationContext)
Create a new SMB connection to the server with the server name, share name and the authentication context.
|
SmbConnection(String serverName,
String shareName,
com.hierynomus.smbj.auth.AuthenticationContext authenticationContext,
com.hierynomus.smbj.SmbConfig smbConfig)
Create a new SMB connection like normal, but with the ability to pass a custom smbj SMB configuration.
|
SmbConnection(String serverName,
String shareName,
com.hierynomus.smbj.auth.AuthenticationContext authenticationContext,
com.hierynomus.smbj.SmbConfig smbConfig,
boolean delayedInitialization)
Create a new SMB connection like normal, but with the ability to pass a custom smbj SMB configuration and to delay the internal creation of the
connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the connection.
|
void |
ensureConnectionIsAlive()
Ensure that the connection is alive.
|
com.hierynomus.smbj.share.DiskShare |
getDiskShare()
Get the disk share to access the server.
|
String |
getServerName()
Get the server name of the server.
|
String |
getShareName()
Get the share name of the server.
|
boolean |
isConnectionAlive()
Check if the connection to the SMB server is alive.
|
public SmbConnection(String serverName, String shareName, com.hierynomus.smbj.auth.AuthenticationContext authenticationContext) throws IOException
Note: The connection itself is not thread safe. Create a connection for each thread communicating with the SMB server.
serverName - Server name of the servershareName - Share name of the serverauthenticationContext - Authentication used to authenticate againstIOException - Exception in case of a problempublic SmbConnection(String serverName, String shareName, com.hierynomus.smbj.auth.AuthenticationContext authenticationContext, com.hierynomus.smbj.SmbConfig smbConfig) throws IOException
Note: The connection itself is not thread safe. Create a connection for each thread communicating with the SMB server.
serverName - Server name of the servershareName - Share name of the serverauthenticationContext - Authentication used to authenticate againstsmbConfig - Custom SMB/smbj configurationIOException - Exception in case of a problempublic SmbConnection(String serverName, String shareName, com.hierynomus.smbj.auth.AuthenticationContext authenticationContext, com.hierynomus.smbj.SmbConfig smbConfig, boolean delayedInitialization) throws IOException
Note: The connection itself is not thread safe. Create a connection for each thread communicating with the SMB server.
serverName - Server name of the servershareName - Share name of the serverauthenticationContext - Authentication used to authenticate againstsmbConfig - Custom SMB/smbj configurationdelayedInitialization - Delay the initialization of the connection until the first access. This can beIOException - Exception in case of a problempublic com.hierynomus.smbj.share.DiskShare getDiskShare()
RuntimeException - Exception in case of a delayed initialization problempublic String getServerName()
public String getShareName()
public boolean isConnectionAlive()
public void ensureConnectionIsAlive()
throws IOException
IOException - Exception in case of a problempublic void close()
throws IOException
close in interface AutoCloseableIOException - Exception in case of a problemCopyright © 2022. All rights reserved.