本文整理匯總了Java中com.sun.jna.Pointer.NULL屬性的典型用法代碼示例。如果您正苦於以下問題:Java Pointer.NULL屬性的具體用法?Java Pointer.NULL怎麽用?Java Pointer.NULL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.sun.jna.Pointer
的用法示例。
在下文中一共展示了Pointer.NULL屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createFSEventStream
private Pointer[] createFSEventStream() throws IOException {
final Pointer root = cf.CFStringCreateWithCString(Pointer.NULL,"/",ENC_MAC_ROMAN); //NOI18N
if (root == Pointer.NULL) {
throw new IOException("Path creation failed."); //NOI18N
}
final Pointer arr = cf.CFArrayCreateMutable(Pointer.NULL, new NativeLong(1), Pointer.NULL);
if (arr == Pointer.NULL) {
throw new IOException("Path list creation failed."); //NOI18N
}
cf.CFArrayAppendValue(arr, root);
final Pointer eventStream = cs.FSEventStreamCreate(Pointer.NULL, callback, Pointer.NULL, arr, kFSEventStreamEventIdSinceNow, LATENCY, kFSEventStreamCreateFlagNoDefer);
if (eventStream == Pointer.NULL) {
throw new IOException("Creation of FSEventStream failed."); //NOI18N
}
final Pointer loop = cf.CFRunLoopGetCurrent();
if (eventStream == Pointer.NULL) {
throw new IOException("Cannot find run loop for caller."); //NOI18N
}
final Pointer kCFRunLoopDefaultMode = findDefaultMode(loop);
if (kCFRunLoopDefaultMode == null) {
throw new IOException("Caller has no defaul run loop mode."); //NOI18N
}
cs.FSEventStreamScheduleWithRunLoop(eventStream, loop, kCFRunLoopDefaultMode);
if (LOG.isLoggable(DEBUG_LOG_LEVEL)) {
LOG.log(DEBUG_LOG_LEVEL, getStreamDescription(eventStream));
}
cs.FSEventStreamStart(eventStream);
return new Pointer[] {eventStream, loop};
}
示例2: findDefaultMode
private Pointer findDefaultMode(final Pointer runLoop) {
final Pointer modes = cf.CFRunLoopCopyAllModes(runLoop);
if (modes != Pointer.NULL) {
final int modesCount = cf.CFArrayGetCount(modes).intValue();
for (int i=0; i< modesCount; i++) {
final Pointer mode = cf.CFArrayGetValueAtIndex(modes, new NativeLong(i));
if (mode != Pointer.NULL && DEFAULT_RUN_LOOP_MODE.equals(cf.CFStringGetCStringPtr(mode, ENC_MAC_ROMAN))) {
return mode;
}
}
}
return null;
}
示例3: getStreamDescription
private String getStreamDescription(final Pointer eventStream) {
final Pointer desc = cs.FSEventStreamCopyDescription(eventStream);
return desc == Pointer.NULL ? "" : cf.CFStringGetCStringPtr(desc, ENC_MAC_ROMAN); //NOI18N
}