Package com.ferrumx.system.hardware
Class Win32_PortableBattery
java.lang.Object
com.ferrumx.system.hardware.Win32_PortableBattery
This class contains methods that query Win32_PortableBattery class of WMI to
fetch Battery information. Can be used alongside the
Win32_Battery
class.
Fetches the following properties: Caption, Name, DeviceID, BatteryStatus, BatteryChemistry, DesignCapacity, DesignVoltage details of your Battery
Version
- Author:
- Egg-03
-
Method Summary
Modifier and TypeMethodDescriptionThis method calls theCIM_ML.getPropertiesAndTheirValues(String, String)
function and passes the WMI Classname and the properties whose values we want to fetch, as parameters
-
Method Details
-
getPortableBattery
public static Map<String,String> getPortableBattery() throws IOException, IndexOutOfBoundsException, ShellException, InterruptedExceptionThis method calls theCIM_ML.getPropertiesAndTheirValues(String, String)
function and passes the WMI Classname and the properties whose values we want to fetch, as parameters- Returns:
- the Caption, Name, DeviceID, BatteryStatus, BatteryChemistry,
DesignCapacity, DesignVoltage details of your Battery in the form of
a
Map
- Throws:
IOException
- re-throws the exception thrown byCIM_ML.getPropertiesAndTheirValues(String, String)
when there are I/O Errors during streaming of data from and to Powershell and other generated filesIndexOutOfBoundsException
- re-throws the exception thrown byCIM_ML.getPropertiesAndTheirValues(String, String)
when there is a parsing error of data fetched from Windows PowershellShellException
- if any internal command used in the powershell throws errorsInterruptedException
- if the thread waiting for the process to exit, gets interrupted. When catching this exception, you may re-throw it's interrupted status by using Thread.currentThread().interrupt();
-