當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。