cn.chenlichao.wmi4j
类 SWbemObjectSet

java.lang.Object
  继承者 cn.chenlichao.wmi4j.SWbemObjectSet

public class SWbemObjectSet
extends Object

An SWbemObjectSet object is a collection of SWbemObject objects. You can get an SWbemObjectSet object by calling any of the following methods or their asynchronous equivalents:

Note: The SWbemObjectSet object does not support the optional Add and Remove collection methods.

Note: Because the call-back to the sink might not be returned at the same authentication level as the client requires, it is recommended that you use semisynchronous instead of asynchronous communication. For more information, see Calling a Method.

Created by chenlichao on 14-7-22.


方法摘要
 int getCount()
          Get how many items are in this SWbemObjectSet collection.
 SWbemSecurity getSecurity()
          The security property is used to read, or set the security settings.
 SWbemObject item(String objectPath)
          The Item method of the SWbemObjectSet object gets an SWbemObject from the collection.
 SWbemObject itemIndex(int index)
          The itemIndex method returns the SWbemObject associated with the specified index into the collection.
 Iterator<E> iterator()
          Create a iterator of this object set.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

item

public SWbemObject item(String objectPath)
                 throws WMIException
The Item method of the SWbemObjectSet object gets an SWbemObject from the collection.

参数:
objectPath - Relative path of the object to retrieve from the collection. Example: Win32_LogicalDisk="C:"
返回:
If successful, the requested SWbemObject object returns.
抛出:
WMIException
IllegalArgumentException - Object path is empty.

itemIndex

public SWbemObject itemIndex(int index)
                      throws WMIException
The itemIndex method returns the SWbemObject associated with the specified index into the collection. The index indicates the position of the element within the collection. Collection numbering starts at zero.

Important: This method only supported by Windows Server 2008 or higher versions.

参数:
index - Index of the item in the collection.
返回:
If successful, the requested SWbemObject object returns.
抛出:
WMIException

getSecurity

public SWbemSecurity getSecurity()
                          throws WMIException
The security property is used to read, or set the security settings. This property is an SWbemSecurity object. The security settings in this object do not indicate the authentication, impersonation, or privilege settings made on a connection to Windows Management Instrumentation (WMI), or the security in effect for the proxy when an object is delivered to a sink in an asynchronous call.

Note: Setting the Security_ property of an SWbemObject object to NULL grants unlimited access to everyone all the time. For more information, see SWbemSecurity.

返回:
The security settings of this WMI object.
抛出:
WMIException

getCount

public int getCount()
             throws WMIException
Get how many items are in this SWbemObjectSet collection. This property is read-only.

One thing to be careful of when using Count is that WMI does not keep a running tally of the number of items in a collection. If you request Count for a collection, WMI cannot instantly respond with a number; instead, it must literally count the items, enumerating the entire collection. For a collection that has relatively few items, such as services, this enumeration likely takes less than a second. Counting the number of events in an event log collection, however, can take considerably longer.

And then suppose you want to display the property values for every event in the collection. If so, WMI will have to enumerate the entire collection a second time.

Note: If you attempt to get this property from an SWbemObjectSet object that is returned from a method where the specified flags are included the wbemFlagForwardOnly flag, you will get an wbemErrFailed error.

返回:
The count of items in this SWbemObjectSet collection.
抛出:
WMIException

iterator

public Iterator<E> iterator()
                                                                         throws WMIException
Create a iterator of this object set.

返回:
Iterator instance.
抛出:
WMIException


Copyright © 2014. All rights reserved.