Class IOKitUtil


  • public class IOKitUtil
    extends java.lang.Object
    Provides utilities for IOKit
    Author:
    widdis[at]gmail[dot]com
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static CoreFoundation.CFMutableDictionaryRef getBSDNameMatchingDict​(java.lang.String bsdName)
      Convenience method to get the IO dictionary matching a bsd name
      static boolean getIORegistryBooleanProperty​(int entry, java.lang.String key)
      Convenience method to get a Boolean value from an IO Registry
      static byte[] getIORegistryByteArrayProperty​(int entry, java.lang.String key)
      Convenience method to get a byte array value from an IO Registry
      static int getIORegistryIntProperty​(int entry, java.lang.String key)
      Convenience method to get an Int value from an IO Registry
      static long getIORegistryLongProperty​(int entry, java.lang.String key)
      Convenience method to get a Long value from an IO Registry
      static java.lang.String getIORegistryStringProperty​(int entry, java.lang.String key)
      Convenience method to get a String value from an IO Registry
      static int getMatchingService​(java.lang.String serviceName)
      Opens an IOService matching the given name
      static int getMatchingServices​(java.lang.String serviceName, com.sun.jna.ptr.IntByReference serviceIterator)
      Convenience method to get matching IOService objects
      static int getMatchingServices​(CoreFoundation.CFMutableDictionaryRef matchingDictionary, com.sun.jna.ptr.IntByReference serviceIterator)
      Convenience method to get matching IOService objects
      static int getRoot()
      Gets the IO Registry root
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getRoot

        public static int getRoot()
        Gets the IO Registry root
        Returns:
        an int handle to the IORoot
      • getMatchingService

        public static int getMatchingService​(java.lang.String serviceName)
        Opens an IOService matching the given name
        Parameters:
        serviceName - The service name to match
        Returns:
        an int handle to an IOService if successful, 0 if failed
      • getMatchingServices

        public static int getMatchingServices​(java.lang.String serviceName,
                                              com.sun.jna.ptr.IntByReference serviceIterator)
        Convenience method to get matching IOService objects
        Parameters:
        serviceName - The service name to match
        serviceIterator - An interator over matching items, set on return
        Returns:
        0 if successful, an error code if failed.
      • getMatchingServices

        public static int getMatchingServices​(CoreFoundation.CFMutableDictionaryRef matchingDictionary,
                                              com.sun.jna.ptr.IntByReference serviceIterator)
        Convenience method to get matching IOService objects
        Parameters:
        matchingDictionary - The dictionary to match
        serviceIterator - An interator over matching items, set on return
        Returns:
        0 if successful, an error code if failed.
      • getIORegistryStringProperty

        public static java.lang.String getIORegistryStringProperty​(int entry,
                                                                   java.lang.String key)
        Convenience method to get a String value from an IO Registry
        Parameters:
        entry - A handle to the registry entry
        key - The string name of the key to retrieve
        Returns:
        The value of the registry entry if it exists; null otherwise
      • getIORegistryLongProperty

        public static long getIORegistryLongProperty​(int entry,
                                                     java.lang.String key)
        Convenience method to get a Long value from an IO Registry
        Parameters:
        entry - A handle to the registry entry
        key - The string name of the key to retrieve
        Returns:
        The value of the registry entry if it exists; 0 otherwise
      • getIORegistryIntProperty

        public static int getIORegistryIntProperty​(int entry,
                                                   java.lang.String key)
        Convenience method to get an Int value from an IO Registry
        Parameters:
        entry - A handle to the registry entry
        key - The string name of the key to retrieve
        Returns:
        The value of the registry entry if it exists; 0 otherwise
      • getIORegistryBooleanProperty

        public static boolean getIORegistryBooleanProperty​(int entry,
                                                           java.lang.String key)
        Convenience method to get a Boolean value from an IO Registry
        Parameters:
        entry - A handle to the registry entry
        key - The string name of the key to retrieve
        Returns:
        The value of the registry entry if it exists; false otherwise
      • getIORegistryByteArrayProperty

        public static byte[] getIORegistryByteArrayProperty​(int entry,
                                                            java.lang.String key)
        Convenience method to get a byte array value from an IO Registry
        Parameters:
        entry - A handle to the registry entry
        key - The string name of the key to retrieve
        Returns:
        The value of the registry entry if it exists; null otherwise
      • getBSDNameMatchingDict

        public static CoreFoundation.CFMutableDictionaryRef getBSDNameMatchingDict​(java.lang.String bsdName)
        Convenience method to get the IO dictionary matching a bsd name
        Parameters:
        bsdName - The bsd name of the registry entry
        Returns:
        The dictionary ref