Class WinTempShare

All Implemented Interfaces:
AutoCloseable

public class WinTempShare extends WindowsTempShare implements AutoCloseable
Class representing a connection to a Windows share
  • Method Details

    • getInstance

      public static WinTempShare getInstance(String hostname, String username, char[] password, long timeout) throws TimeoutException, WmiComException
      Create or get a cached instance of a shared temporary directory on the specified host.

      This method ensures only one instance of this class is created per host.

      Parameters:
      hostname - Host to connect to
      username - Username (may be null)
      password - Password (may be null)
      timeout - Timeout in milliseconds
      Returns:
      the WinTempShare instance
      Throws:
      TimeoutException - To notify userName of timeout.
      WmiComException - For any problem encountered with JNA.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • isConnected

      public boolean isConnected()
      Returns:
      whether we are connected to this share and can interact with it
    • checkConnectedFirst

      public void checkConnectedFirst()
      Check if it's connected. If not, throw an IllegalStateException.