// // This file is auto-generated by wpilibj/wpilibJavaJNI/nivision/gen_java.py // Please do not edit! // package com.ni.vision; import java.lang.reflect.*; import java.io.UnsupportedEncodingException; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class NIVision { private NIVision() {} private static native void imaqDispose(long addr); private static Constructor constructDirectByteBuffer; private static Field bufferAddressField; static { try { Class[] cArg = new Class[2]; cArg[0] = long.class; cArg[1] = int.class; constructDirectByteBuffer = Class.forName("java.nio.DirectByteBuffer").getDeclaredConstructor(cArg); constructDirectByteBuffer.setAccessible(true); bufferAddressField = Buffer.class.getDeclaredField("address"); bufferAddressField.setAccessible(true); } catch (ReflectiveOperationException e) { throw new ExceptionInInitializerError(e); } } private static ByteBuffer newDirectByteBuffer(long addr, int cap) { try { return ((ByteBuffer)(constructDirectByteBuffer.newInstance(addr, cap))).order(ByteOrder.nativeOrder()); } catch (ReflectiveOperationException e) { throw new ExceptionInInitializerError(e); } } private static long getByteBufferAddress(ByteBuffer bb) { try { return bufferAddressField.getLong(bb); } catch (IllegalAccessException e) { return 0; } } public static ByteBuffer sliceByteBuffer(ByteBuffer bb, int offset, int size) { ByteBuffer new_bb = bb.duplicate(); new_bb.position(offset); new_bb.limit(size); return new_bb; } public static ByteBuffer getBytes(ByteBuffer bb, byte[] dst, int offset, int size) { for (int i=offset; i