public class WmiUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static WmiUtil |
INSTANCE
Instance to generate the WmiConnection class.
|
static String |
OHM_NAMESPACE |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Enum<T>> |
getDateString(WbemcliUtil.WmiResult<T> result,
T property,
int index)
Gets a Date value from a WmiResult as a String
|
static <T extends Enum<T>> |
getFloat(WbemcliUtil.WmiResult<T> result,
T property,
int index)
Gets a Float value from a WmiResult
|
static <T extends Enum<T>> |
getRefString(WbemcliUtil.WmiResult<T> result,
T property,
int index)
Gets a Reference value from a WmiResult as a String
|
static <T extends Enum<T>> |
getSint32(WbemcliUtil.WmiResult<T> result,
T property,
int index)
Gets a Sint32 value from a WmiResult.
|
static <T extends Enum<T>> |
getString(WbemcliUtil.WmiResult<T> result,
T property,
int index)
Gets a String value from a WmiResult
|
static <T extends Enum<T>> |
getUint16(WbemcliUtil.WmiResult<T> result,
T property,
int index)
Gets a Uint16 value from a WmiResult.
|
static <T extends Enum<T>> |
getUint32(WbemcliUtil.WmiResult<T> result,
T property,
int index)
Gets an UINT32 value from a WmiResult.
|
static <T extends Enum<T>> |
getUint32asLong(WbemcliUtil.WmiResult<T> result,
T property,
int index)
Gets an UINT32 value from a WmiResult as a long, preserving the
unsignedness.
|
static <T extends Enum<T>> |
getUint64(WbemcliUtil.WmiResult<T> result,
T property,
int index)
Gets a Uint64 value from a WmiResult (parsing the String).
|
static int |
getWmiTimeout()
Gets the current WMI timeout.
|
static boolean |
hasNamespace(String namespace)
Determine if WMI has the requested namespace.
|
static void |
initCOM()
Initializes COM library and sets security to impersonate the local user
|
static boolean |
isComInitialized()
COM may already have been initialized outside this class.
|
static boolean |
isSecurityInitialized()
Security only needs to be initialized once.
|
static <T extends Enum<T>> |
queryWMI(WbemcliUtil.WmiQuery<T> query)
Query WMI for values, with no timeout.
|
static void |
setWmiTimeout(int wmiTimeout)
Sets the WMI timeout.
|
static void |
unInitCOM()
UnInitializes COM library if it was initialized by the
initCOM()
method. |
public static final WmiUtil INSTANCE
public static final String OHM_NAMESPACE
public static boolean hasNamespace(String namespace)
namespace - The namespace to testpublic static <T extends Enum<T>> WbemcliUtil.WmiResult<T> queryWMI(WbemcliUtil.WmiQuery<T> query)
T - The enum type containing the property keysquery - A WmiQuery object encapsulating the namespace, class, and
propertiespublic static <T extends Enum<T>> String getString(WbemcliUtil.WmiResult<T> result, T property, int index)
T - The enum type containing the property keysresult - The WmiResult from which to fetch the valueproperty - The property (column) to fetchindex - The index (row) to fetchpublic static <T extends Enum<T>> String getDateString(WbemcliUtil.WmiResult<T> result, T property, int index)
T - The enum type containing the property keysresult - The WmiResult from which to fetch the valueproperty - The property (column) to fetchindex - The index (row) to fetchpublic static <T extends Enum<T>> String getRefString(WbemcliUtil.WmiResult<T> result, T property, int index)
T - The enum type containing the property keysresult - The WmiResult from which to fetch the valueproperty - The property (column) to fetchindex - The index (row) to fetchpublic static <T extends Enum<T>> long getUint64(WbemcliUtil.WmiResult<T> result, T property, int index)
T - The enum type containing the property keysresult - The WmiResult from which to fetch the valueproperty - The property (column) to fetchindex - The index (row) to fetchpublic static <T extends Enum<T>> int getUint32(WbemcliUtil.WmiResult<T> result, T property, int index)
T - The enum type containing the property keysresult - The WmiResult from which to fetch the valueproperty - The property (column) to fetchindex - The index (row) to fetchpublic static <T extends Enum<T>> long getUint32asLong(WbemcliUtil.WmiResult<T> result, T property, int index)
T - The enum type containing the property keysresult - The WmiResult from which to fetch the valueproperty - The property (column) to fetchindex - The index (row) to fetchpublic static <T extends Enum<T>> int getSint32(WbemcliUtil.WmiResult<T> result, T property, int index)
T - The enum type containing the property keysresult - The WmiResult from which to fetch the valueproperty - The property (column) to fetchindex - The index (row) to fetchpublic static <T extends Enum<T>> int getUint16(WbemcliUtil.WmiResult<T> result, T property, int index)
T - The enum type containing the property keysresult - The WmiResult from which to fetch the valueproperty - The property (column) to fetchindex - The index (row) to fetchpublic static <T extends Enum<T>> float getFloat(WbemcliUtil.WmiResult<T> result, T property, int index)
T - The enum type containing the property keysresult - The WmiResult from which to fetch the valueproperty - The property (column) to fetchindex - The index (row) to fetchpublic static void initCOM()
public static void unInitCOM()
initCOM()
method. Otherwise, does nothing.public static boolean isComInitialized()
public static boolean isSecurityInitialized()
public static int getWmiTimeout()
public static void setWmiTimeout(int wmiTimeout)
wmiTimeout - The wmiTimeout to set, in milliseconds. To disable timeouts,
set timeout as -1 (infinite).Copyright © 2010–2018 oshi. All rights reserved.