Class CfUtil


  • public class CfUtil
    extends java.lang.Object
    Provides utilities for Core Foundations
    Author:
    widdis[at]gmail[dot]com
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CfUtil.CFNumberType
      Enum values used for number type in CFNumberGetValue().
    • Constructor Summary

      Constructors 
      Constructor Description
      CfUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean cfPointerToBoolean​(com.sun.jna.Pointer p)
      Convert a pointer representing a Core Foundations Boolean into its boolean
      static int cfPointerToInt​(com.sun.jna.Pointer p)
      Convert a pointer representing a Core Foundations LongLong into its long
      static long cfPointerToLong​(com.sun.jna.Pointer p)
      Convert a pointer representing a Core Foundations LongLong into its long
      static java.lang.String cfPointerToString​(com.sun.jna.Pointer p)
      Convert a pointer representing a Core Foundations String into its string
      static CoreFoundation.CFStringRef getCFString​(java.lang.String key)
      Return a CFStringRef representing a string, caching the result
      static void release​(com.sun.jna.PointerType ref)
      Releases a CF reference.
      • Methods inherited from class java.lang.Object

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

      • CfUtil

        public CfUtil()
    • Method Detail

      • getCFString

        public static CoreFoundation.CFStringRef getCFString​(java.lang.String key)
        Return a CFStringRef representing a string, caching the result
        Parameters:
        key - The string, usually a registry key
        Returns:
        the corresponding CFString
      • cfPointerToLong

        public static long cfPointerToLong​(com.sun.jna.Pointer p)
        Convert a pointer representing a Core Foundations LongLong into its long
        Parameters:
        p - The pointer to a 64-bit integer
        Returns:
        The corresponding long
      • cfPointerToInt

        public static int cfPointerToInt​(com.sun.jna.Pointer p)
        Convert a pointer representing a Core Foundations LongLong into its long
        Parameters:
        p - The pointer to an integer
        Returns:
        The corresponding int
      • cfPointerToBoolean

        public static boolean cfPointerToBoolean​(com.sun.jna.Pointer p)
        Convert a pointer representing a Core Foundations Boolean into its boolean
        Parameters:
        p - The pointer to a boolean
        Returns:
        The corresponding boolean
      • cfPointerToString

        public static java.lang.String cfPointerToString​(com.sun.jna.Pointer p)
        Convert a pointer representing a Core Foundations String into its string
        Parameters:
        p - The pointer to a CFString
        Returns:
        The corresponding string
      • release

        public static void release​(com.sun.jna.PointerType ref)
        Releases a CF reference. Mandatory when an object is owned (using 'create' or 'copy' methods).
        Parameters:
        ref - The reference to release