Interface CoreFoundation
- All Superinterfaces:
- Library
 Core Foundation functions have names that indicate when you own a returned
 object: Object-creation functions have “Create” embedded in the name, and
 Object-duplication functions that have “Copy” embedded in the name. If you
 own an object, it is your responsibility to relinquish ownership (using
 CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)) when you have finished with it.
 
 If you receive an object from any Core Foundation function other than a
 creation or copy function—such as a Get function—you do not own it and cannot
 be certain of the object’s life span. If you want to ensure that such an
 object is not disposed of while you are using it, you must claim ownership
 (with the CFRetain(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef) function).
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classA reference type used in many Core Foundation parameters and function results.static classA reference to an immutableCFArrayobject.static classA reference to aCFBooleanobject.static classA reference to an immutableCFDataobject.static classA reference to an immutableCFDictionaryobject.static classA wrapper for theNativeLongtype, used forCoreFoundation.CFNumberReftypes,CoreFoundation.CFStringReflengths, andCoreFoundation.CFArrayRefsizes and indices.static classA reference to a mutableCFDictionaryobject.static classA reference to aCFNumberobject.static enumstatic classA reference to aCFStringobject, which “encapsulates” a Unicode string along with its length.static classA type for unique, constant integer values that identify particular Core Foundation opaque types.static classTheCFTypeReftype is the base type defined in Core Foundation.Nested classes/interfaces inherited from interface com.sun.jna.LibraryLibrary.Handler
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final CoreFoundation.CFTypeIDstatic final CoreFoundation.CFTypeIDstatic final CoreFoundation.CFTypeIDstatic final CoreFoundation.CFTypeIDstatic final CoreFoundation.CFTypeIDstatic final CoreFoundationstatic final intstatic final intstatic final intstatic final CoreFoundation.CFTypeIDstatic final CoreFoundation.CFTypeIDFields inherited from interface com.sun.jna.LibraryOPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_SYMBOL_PROVIDER, OPTION_TYPE_MAPPER
- 
Method SummaryModifier and TypeMethodDescriptionGets the default allocator object for the current thread.CFArrayCreate(CoreFoundation.CFAllocatorRef alloc, Pointer values, CoreFoundation.CFIndex numValues, Pointer callBacks) Creates a new immutable array with the given values.CFArrayGetCount(CoreFoundation.CFArrayRef theArray) Returns the number of values currently in an array.Retrieves a value at a given index.byteReturns the value of aCFBooleanobject.Returns a textual description of a Core Foundation object.CFDataCreate(CoreFoundation.CFAllocatorRef alloc, Pointer bytes, CoreFoundation.CFIndex length) Creates an immutableCFDataobject using data copied from a specified byte buffer.CFDataGetBytePtr(CoreFoundation.CFDataRef theData) Returns a read-only pointer to the bytes of aCFDataobject.CFDataGetLength(CoreFoundation.CFDataRef theData) Returns the number of bytes contained by aCFDataobject.CFDictionaryCreateMutable(CoreFoundation.CFAllocatorRef alloc, CoreFoundation.CFIndex capacity, Pointer keyCallBacks, Pointer valueCallBacks) Creates a new mutable dictionary.Returns the number of key-value pairs in a dictionary.CFDictionaryGetValue(CoreFoundation.CFDictionaryRef theDict, PointerType key) Returns the value associated with a given key.byteCFDictionaryGetValueIfPresent(CoreFoundation.CFDictionaryRef theDict, PointerType key, PointerByReference value) Returns a boolean value that indicates whether a given value for a given key is in a dictionary, and returns that value indirectly if it exists.voidCFDictionarySetValue(CoreFoundation.CFMutableDictionaryRef theDict, PointerType key, PointerType value) Sets the value corresponding to a given key.booleanDetermines whether two Core Foundation objects are considered equal.Returns the reference count of a Core Foundation object.CFGetTypeID(CoreFoundation.CFTypeRef theObject) Returns the type of aCFTypeobject.CFGetTypeID(Pointer theObject) Returns the type of aCFTypeobject presented as a pointer.CFNumberCreate(CoreFoundation.CFAllocatorRef alloc, CoreFoundation.CFIndex theType, ByReference valuePtr) Creates aCFNumberobject using a specified value.Returns the type used by aCFNumberobject to store its value.byteCFNumberGetValue(CoreFoundation.CFNumberRef number, CoreFoundation.CFIndex theType, ByReference valuePtr) Obtains the value of aCFNumberobject cast to a specified type.voidReleases a Core Foundation object.Retains a Core Foundation object.CFStringCreateWithCharacters(CoreFoundation.CFAllocatorRef alloc, char[] chars, CoreFoundation.CFIndex length) Creates a string from a buffer of Unicode characters.byteCFStringGetCString(CoreFoundation.CFStringRef theString, Pointer bufferToFill, CoreFoundation.CFIndex bufferSize, int encoding) Copies the character contents of a string to a local C string buffer after converting the characters to a given encoding.CFStringGetLength(CoreFoundation.CFStringRef theString) Returns the number (in terms of UTF-16 code pairs) of Unicode characters in a string.CFStringGetMaximumSizeForEncoding(CoreFoundation.CFIndex length, int encoding) Returns the maximum number of bytes a string of a specified length (in Unicode characters) will take up if encoded in a specified encoding.
- 
Field Details- 
INSTANCE
- 
kCFNotFoundstatic final int kCFNotFound- See Also:
 
- 
kCFStringEncodingASCIIstatic final int kCFStringEncodingASCII- See Also:
 
- 
kCFStringEncodingUTF8static final int kCFStringEncodingUTF8- See Also:
 
- 
ARRAY_TYPE_ID
- 
BOOLEAN_TYPE_ID
- 
DATA_TYPE_ID
- 
DATE_TYPE_ID
- 
DICTIONARY_TYPE_ID
- 
NUMBER_TYPE_ID
- 
STRING_TYPE_ID
 
- 
- 
Method Details- 
CFStringCreateWithCharactersCoreFoundation.CFStringRef CFStringCreateWithCharacters(CoreFoundation.CFAllocatorRef alloc, char[] chars, CoreFoundation.CFIndex length) Creates a string from a buffer of Unicode characters.This reference must be released with CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)to avoid leaking references.- Parameters:
- alloc- The allocator to use to allocate memory for the new string. Pass- nullor- kCFAllocatorDefaultto use the current default allocator.
- chars- The buffer of Unicode characters to copy into the new string.
- length- The number of characters in the buffer pointed to by chars. Only this number of characters will be copied to internal storage.
- Returns:
- An immutable string containing chars, ornullif there was a problem creating the object.
 
- 
CFNumberCreateCoreFoundation.CFNumberRef CFNumberCreate(CoreFoundation.CFAllocatorRef alloc, CoreFoundation.CFIndex theType, ByReference valuePtr) Creates aCFNumberobject using a specified value.This reference must be released with CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)to avoid leaking references.- Parameters:
- alloc- The allocator to use to allocate memory for the new object. Pass- nullor- kCFAllocatorDefaultto use the current default allocator.
- theType- A constant that specifies the data type of the value to convert. The ordinal value of the enum.- The - theTypeparameter is not necessarily preserved when creating a new- CFNumberobject. The- CFNumberobject will be created using whatever internal storage type the creation function deems appropriate. Use the function- CFNumberGetType(com.sun.jna.platform.mac.CoreFoundation.CFNumberRef)to find out what type the- CFNumberobject used to store your value.
- valuePtr- A pointer to the value for the returned number object.
- Returns:
- A new number with the value specified by valuePtr.
 
- 
CFArrayCreateCoreFoundation.CFArrayRef CFArrayCreate(CoreFoundation.CFAllocatorRef alloc, Pointer values, CoreFoundation.CFIndex numValues, Pointer callBacks) Creates a new immutable array with the given values.This reference must be released with CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)to avoid leaking references.- Parameters:
- alloc- The allocator to use to allocate memory for the new array and its storage for values. Pass- nullor- kCFAllocatorDefaultto use the current default allocator.
- values- A C array of the pointer-sized values to be in the new array. The values in the new array are ordered in the same order in which they appear in this C array. This value may be- nullif- numValuesis 0. This C array is not changed or freed by this function. If- valuesis not a valid pointer to a C array of at least- numValueselements, the behavior is undefined.
- numValues- The number of values to copy from the- valuesC array into the new array. This number will be the count of the new array—it must not be negative or greater than the number of elements in values.
- callBacks- A pointer to a- CFArrayCallBacksstructure initialized with the callbacks for the array to use on each value in the collection. The retain callback is used within this function, for example, to retain all of the new values from the- valuesC array. A copy of the contents of the callbacks structure is made, so that a pointer to a structure on the stack can be passed in or can be reused for multiple collection creations.- This value may be - null, which is treated as if a valid structure of version 0 with all fields- nullhad been passed in.
- Returns:
- A new immutable array containing numValuesfromvalues, ornullif there was a problem creating the object.
 
- 
CFDataCreateCoreFoundation.CFDataRef CFDataCreate(CoreFoundation.CFAllocatorRef alloc, Pointer bytes, CoreFoundation.CFIndex length) Creates an immutableCFDataobject using data copied from a specified byte buffer.This reference must be released with CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)to avoid leaking references.- Parameters:
- alloc- The allocator to use to allocate memory for the new object. Pass- nullor- kCFAllocatorDefaultto use the current default allocator.
- bytes- A pointer to the byte buffer that contains the raw data to be copied into the Data.
- length- The number of bytes in the buffer (- bytes).
- Returns:
- A new CFDataobject, ornullif there was a problem creating the object.
 
- 
CFDictionaryCreateMutableCoreFoundation.CFMutableDictionaryRef CFDictionaryCreateMutable(CoreFoundation.CFAllocatorRef alloc, CoreFoundation.CFIndex capacity, Pointer keyCallBacks, Pointer valueCallBacks) Creates a new mutable dictionary.This reference must be released with CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)to avoid leaking references.- Parameters:
- alloc- The allocator to use to allocate memory for the new string. Pass- nullor- kCFAllocatorDefaultto use the current default allocator.
- capacity- The maximum number of key-value pairs that can be contained by the new dictionary. The dictionary starts empty and can grow to this number of key-value pairs (and it can have less).- Pass 0 to specify that the maximum capacity is not limited. The value must not be negative. 
- keyCallBacks- A pointer to a- CFDictionaryKeyCallBacksstructure initialized with the callbacks to use to retain, release, describe, and compare keys in the dictionary. A copy of the contents of the callbacks structure is made, so that a pointer to a structure on the stack can be passed in or can be reused for multiple collection creations.- This value may be - null, which is treated as a valid structure of version 0 with all fields- null.
- valueCallBacks- A pointer to a- CFDictionaryValueCallBacksstructure initialized with the callbacks to use to retain, release, describe, and compare values in the dictionary. A copy of the contents of the callbacks structure is made, so that a pointer to a structure on the stack can be passed in or can be reused for multiple collection creations.- This value may be - null, which is treated as a valid structure of version 0 with all fields- null.
- Returns:
- A new dictionary, or nullif there was a problem creating the object.
 
- 
CFCopyDescriptionReturns a textual description of a Core Foundation object.The nature of the description differs by object. For example, a description of a CFArray object would include descriptions of each of the elements in the collection. You can use this function for debugging Core Foundation objects in your code. Note, however, that the description for a given object may be different in different releases of the operating system. Do not create dependencies in your code on the content or format of the information returned by this function. - Parameters:
- cf- The- CFTypeobject (a generic reference of type- CFTypeRef) from which to derive a description.
- Returns:
- A string that contains a description of cf.
 
- 
CFReleaseReleases a Core Foundation object.If the retain count of cfbecomes zero the memory allocated to the object is deallocated and the object is destroyed. If you create, copy, or explicitly retain (see theCFRetain(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)function) a Core Foundation object, you are responsible for releasing it when you no longer need it.- Parameters:
- cf- A- CFTypeobject to release. This value must not be- null.
 
- 
CFRetainRetains a Core Foundation object. You should retain a Core Foundation object when you receive it from elsewhere (that is, you did not create or copy it) and you want it to persist.If you retain a Core Foundation object you are responsible for releasing it with CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef).- Parameters:
- cf- The- CFTypeobject to retain. This value must not be- null.
- Returns:
- The input value, {code cf}.
 
- 
CFGetRetainCountReturns the reference count of a Core Foundation object.- Parameters:
- cf- The- CFTypeobject to examine.
- Returns:
- A number representing the reference count of {code cf}.
 
- 
CFDictionaryGetCountReturns the number of key-value pairs in a dictionary.- Parameters:
- theDict- The dictionary to examine.
- Returns:
- The number of key-value pairs in theDict.
 
- 
CFDictionaryGetValueReturns the value associated with a given key.- Parameters:
- theDict- The dictionary to examine.
- key- The key for which to find a match in- theDict. The key hash and equal callbacks provided when the dictionary was created are used to compare. If the hash callback was- null, the key is treated as a pointer and converted to an integer. If the equal callback was- null, pointer equality (in C, ==) is used. If- key, or any of the keys in- theDict, is not understood by the equal callback, the behavior is undefined.
- Returns:
- The value associated with key in theDict, ornullif no key-value pair matching key exists. Sincenullis also a valid value in some dictionaries, useCFDictionaryGetValueIfPresent(com.sun.jna.platform.mac.CoreFoundation.CFDictionaryRef, com.sun.jna.PointerType, com.sun.jna.ptr.PointerByReference)to distinguish between a value that is not found, and anullvalue.
 
- 
CFDictionaryGetValueIfPresentbyte CFDictionaryGetValueIfPresent(CoreFoundation.CFDictionaryRef theDict, PointerType key, PointerByReference value) Returns a boolean value that indicates whether a given value for a given key is in a dictionary, and returns that value indirectly if it exists.- Parameters:
- theDict- The dictionary to examine.
- key- The key for which to find a match in- theDict. The key hash and equal callbacks provided when the dictionary was created are used to compare. If the hash callback was- null, the key is treated as a pointer and converted to an integer. If the equal callback was- null, pointer equality (in C, ==) is used. If- key, or any of the keys in- theDict, is not understood by the equal callback, the behavior is undefined.
- value- A pointer to memory which, on return, is filled with the pointer-sized value if a matching key is found. If no key match is found, the contents of the storage pointed to by this parameter are undefined. This value may be- null, in which case the value from the dictionary is not returned (but the return value of this function still indicates whether or not the key-value pair was present).
- Returns:
- 1 if a matching key was found, otherwise 0.
 
- 
CFDictionarySetValuevoid CFDictionarySetValue(CoreFoundation.CFMutableDictionaryRef theDict, PointerType key, PointerType value) Sets the value corresponding to a given key.- Parameters:
- theDict- The dictionary to modify. If this parameter is a fixed-capacity dictionary and it is full before this operation, and the key does not exist in the dictionary, the behavior is undefined.
- key- The key of the value to set in- theDict. If a key which matches- keyis already present in the dictionary, only the value for the key is changed ("add if absent, replace if present"). If no key matches- key, the key-value pair is added to the dictionary.- If a key-value pair is added, both key and value are retained by the dictionary, using the retain callback provided when - theDictwas created.- keymust be of the type expected by the key retain callback.
- value- The value to add to or replace in- theDict.- valueis retained using the value retain callback provided when- theDictwas created, and the previous value if any is released.- valuemust be of the type expected by the retain and release callbacks.
 
- 
CFStringGetCStringbyte CFStringGetCString(CoreFoundation.CFStringRef theString, Pointer bufferToFill, CoreFoundation.CFIndex bufferSize, int encoding) Copies the character contents of a string to a local C string buffer after converting the characters to a given encoding.- Parameters:
- theString- The string whose contents you wish to access.
- bufferToFill- The C string buffer into which to copy the string. On return, the buffer contains the converted characters. If there is an error in conversion, the buffer contains only partial results.- The buffer must be large enough to contain the converted characters and a NUL terminator. 
- bufferSize- The length of- bufferin bytes.
- encoding- The string encoding to which the character contents of- theStringshould be converted. The encoding must specify an 8-bit encoding.
- Returns:
- 1 upon success or 0 if the conversion fails or the provided buffer is too small.
 
- 
CFBooleanGetValueReturns the value of aCFBooleanobject.- Parameters:
- bool- The boolean to examine.
- Returns:
- 1 if the value of boolistrue, 0 otherwise.
 
- 
CFArrayGetCountReturns the number of values currently in an array.- Parameters:
- theArray- a- CoreFoundation.CFArrayRefobject.
- Returns:
- The number of values in array.
 
- 
CFArrayGetValueAtIndexRetrieves a value at a given index.- Parameters:
- theArray- The array to examine.
- idx- The index of the value to retrieve. If the index is outside the index space of- theArray(0 to N-1 inclusive (where N is the count of- theArray)), the behavior is undefined.
- Returns:
- The value at the idxindex intheArray).
 
- 
CFNumberGetTypeReturns the type used by aCFNumberobject to store its value.- Parameters:
- number- The- CFNumberobject to examine.
- Returns:
- A constant that indicates the data type of the value contained in
         number. See CoreFoundation.CFNumberTypefor a list of possible values.
 
- 
CFNumberGetValuebyte CFNumberGetValue(CoreFoundation.CFNumberRef number, CoreFoundation.CFIndex theType, ByReference valuePtr) Obtains the value of aCFNumberobject cast to a specified type.- Parameters:
- number- The- CFNumberobject to examine.
- theType- A constant that specifies the data type to return. See- CoreFoundation.CFNumberTypefor a list of possible values.
- valuePtr- On return, contains the value of- number.
- Returns:
- 1 if the operation was successful, otherwise 0.
 
- 
CFStringGetLengthReturns the number (in terms of UTF-16 code pairs) of Unicode characters in a string.- Parameters:
- theString- The string to examine.
- Returns:
- The number (in terms of UTF-16 code pairs) of characters stored in
         theString.
 
- 
CFStringGetMaximumSizeForEncodingCoreFoundation.CFIndex CFStringGetMaximumSizeForEncoding(CoreFoundation.CFIndex length, int encoding) Returns the maximum number of bytes a string of a specified length (in Unicode characters) will take up if encoded in a specified encoding.- Parameters:
- length- The number of Unicode characters to evaluate.
- encoding- The string encoding for the number of characters specified by length.
- Returns:
- The maximum number of bytes that could be needed to represent length
         number of Unicode characters with the string encoding encoding, or
         kCFNotFoundif the number exceedsLong.MAX_VALUE.
 
- 
CFEqualDetermines whether two Core Foundation objects are considered equal.- Parameters:
- cf1- A CFType object to compare to cf2.
- cf2- A CFType object to compare to cf1.
- Returns:
- true if cf1 and cf2 are of the same type and considered equal, otherwise false.
 
- 
CFAllocatorGetDefaultCoreFoundation.CFAllocatorRef CFAllocatorGetDefault()Gets the default allocator object for the current thread.- Returns:
- A reference to the default allocator for the current thread. If none
         has been explicitly set, returns the generic system allocator.
         The default allocator can never be released, so it is not necessary to CFRetain(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)this reference.
 
- 
CFDataGetLengthReturns the number of bytes contained by aCFDataobject.- Parameters:
- theData- The- CFDataobject to examine.
- Returns:
- An index that specifies the number of bytes in theData.
 
- 
CFDataGetBytePtrReturns a read-only pointer to the bytes of aCFDataobject.- Parameters:
- theData- The- CFDataobject to examine.
- Returns:
- A read-only pointer to the bytes associated with theData.
 
- 
CFGetTypeIDReturns the type of aCFTypeobject.- Parameters:
- theObject- The- CFDataobject to examine.
- Returns:
- A value of type CoreFoundation.CFTypeIDthat identifies the opaque type ofcf.
 
- 
CFGetTypeIDReturns the type of aCFTypeobject presented as a pointer. Allows to inspect object type without creating aCoreFoundation.CFTypeRefwrapper.- Parameters:
- theObject- The pointer to- CFDataobject to examine.
- Returns:
- A value of type CoreFoundation.CFTypeIDthat identifies the opaque type ofcf.
 
- 
CFArrayGetTypeIDCoreFoundation.CFTypeID CFArrayGetTypeID()- Returns:
- The type identifier for the CFArrayopaque type.
 
- 
CFBooleanGetTypeIDCoreFoundation.CFTypeID CFBooleanGetTypeID()- Returns:
- The type identifier for the CFBooleanopaque type.
 
- 
CFDateGetTypeIDCoreFoundation.CFTypeID CFDateGetTypeID()- Returns:
- The type identifier for the CFDateopaque type.
 
- 
CFDataGetTypeIDCoreFoundation.CFTypeID CFDataGetTypeID()- Returns:
- The type identifier for the CFDataopaque type.CFMutableDataobjects have the same type identifier asCFDataobjects.
 
- 
CFDictionaryGetTypeIDCoreFoundation.CFTypeID CFDictionaryGetTypeID()- Returns:
- The type identifier for the CFDictionaryopaque type.CFMutableDictionaryobjects have the same type identifier asCFDictionaryobjects.
 
- 
CFNumberGetTypeIDCoreFoundation.CFTypeID CFNumberGetTypeID()- Returns:
- The type identifier for the CFNumberopaque type.
 
- 
CFStringGetTypeIDCoreFoundation.CFTypeID CFStringGetTypeID()- Returns:
- The type identifier for the CFStringopaque type.
 
 
-