Java Code Examples for com.sun.jna.NativeLong#intValue()
The following examples show how to use
com.sun.jna.NativeLong#intValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ErrorUtil.java From canon-sdk-java with MIT License | 5 votes |
/** * Convert a long value to it's corresponding EDSDK error. * * @param value native long that was returned by a method from {@link org.blackdread.camerabinding.jna.EdsdkLibrary} * @return edsdk error from native long */ public static EdsdkError toEdsdkError(final NativeLong value) { for (EdsdkError error : EdsdkError.values()) { if (error.value().equals(value.intValue())) return error; } log.error("Unknown native error value: {}, {}", value.intValue(), value.longValue()); // either we throw or maybe a default error like EDS_ERR_UNEXPECTED_EXCEPTION or another throw new IllegalArgumentException("Unknown native error value: " + value.intValue() + ", " + value.longValue()); }
Example 2
Source File: ReleaseUtil.java From canon-sdk-java with MIT License | 5 votes |
/** * Release a ref from the camera * * @param ref refs to release */ public static void release(final EdsdkLibrary.EdsBaseRef ref) { if (ref != null) { final NativeLong nativeLong = CanonFactory.edsdkLibrary().EdsRelease(ref); if (nativeLong.intValue() == 0xFFFFFFFF) { log.warn("Failed to release {}", ref); } } }
Example 3
Source File: DllTest.java From canon-sdk-java with MIT License | 5 votes |
private static void loadLibraryBasics(final String libPath) { final EdsdkLibrary library = Native.loadLibrary(libPath, EdsdkLibrary.class, new HashMap<>()); NativeLong result = library.EdsInitializeSDK(); if (result.intValue() != 0) fail("Failed to init SDK"); result = library.EdsTerminateSDK(); if (result.intValue() != 0) fail("Failed to terminate SDK"); }
Example 4
Source File: OSXNotifier.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void invoke(Pointer streamRef, Pointer clientCallBackInfo, NativeLong numEvents, Pointer eventPaths, Pointer eventFlags, Pointer eventIds) { final long st = System.currentTimeMillis(); final int length = numEvents.intValue(); final Pointer[] pointers = eventPaths.getPointerArray(0, length); int flags[]; if (eventFlags == null) { flags = new int[length]; LOG.log(DEBUG_LOG_LEVEL, "FSEventStreamCallback eventFlags == null, expected int[] of size {0}", length); //NOI18N } else { flags = eventFlags.getIntArray(0, length); } for (int i=0; i<length; i++) { final Pointer p = pointers[i]; int flag = flags[i]; final String path = p.getString(0); if ((flag & kFSEventStreamEventFlagMustScanSubDirs) == kFSEventStreamEventFlagMustScanSubDirs || (flag & kFSEventStreamEventFlagMount) == kFSEventStreamEventFlagMount || (flag & kFSEventStreamEventFlagUnmount) == kFSEventStreamEventFlagUnmount) { events.add(ALL_CHANGE); } else { events.add(path); } LOG.log(DEBUG_LOG_LEVEL, "Event on {0}", new Object[]{path}); } LOG.log(PERF_LOG_LEVEL, "Callback time: {0}", (System.currentTimeMillis() - st)); }
Example 5
Source File: CFData.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public ByteBuffer getBuffer() { NativeLong length = _getLength(); if (length.intValue() <= 0) return ByteBuffer.allocate(0); CFRange.ByValue range = new CFRange.ByValue(); range.length = length; range.location = ZERO; ByteBuffer buffer = ByteBuffer.allocate(length.intValue()); CFLibrary.INSTANCE.CFDataGetBytes(this, range, buffer); return buffer; }
Example 6
Source File: CFData.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public int getLength() { NativeLong nl = CFLibrary.INSTANCE.CFDataGetLength(this); return nl.intValue(); }