本文整理汇总了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
}