当前位置: 首页>>代码示例>>Java>>正文


Java Pointer.NULL属性代码示例

本文整理汇总了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};
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:OSXNotifier.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:OSXNotifier.java

示例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
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:OSXNotifier.java


注:本文中的com.sun.jna.Pointer.NULL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。