/** Write the given array of Pointer to native memory. * @param bOff byte offset from pointer into which data is copied * @param buf <code>Pointer</code> array from which to copy * @param index array index from which to start copying * @param length number of elements from <code>buf</code> that must be * copied */ public void write(long bOff, Pointer[] buf, int index, int length) { for (int i=0;i < length;i++) { setPointer(bOff + i * Native.POINTER_SIZE, buf[index + i]); } }
/** * Indirect the native pointer to <code>malloc</code> space, a la * <code>Pointer.setPointer</code>. But this method performs * a bounds checks to ensure that the indirection does not cause memory * outside the <code>malloc</code>ed space to be accessed. * * @see Pointer#setPointer */ @Override public void setPointer(long offset, Pointer value) { boundsCheck(offset, Native.POINTER_SIZE); super.setPointer(offset, value); }
public void setValue(Pointer value) { getPointer().setPointer(0, value); }
setDouble(offset, value == null ? 0.0 : ((Double)value).doubleValue()); } else if (type == Pointer.class) { setPointer(offset, (Pointer)value); } else if (type == String.class) { setPointer(offset, (Pointer)value); } else if (type == WString.class) { setPointer(offset, (Pointer)value); } else if (Structure.class.isAssignableFrom(type)) { Structure s = (Structure)value; if (Structure.ByReference.class.isAssignableFrom(type)) { setPointer(offset, s == null ? null : s.getPointer()); if (s != null) { s.autoWrite(); setPointer(offset, CallbackReference.getFunctionPointer((Callback)value)); } else if (Platform.HAS_BUFFERS && Buffer.class.isAssignableFrom(type)) { Pointer p = value == null ? null : Native.getDirectBufferPointer((Buffer)value); setPointer(offset, p); } else if (NativeMapped.class.isAssignableFrom(type)) { NativeMappedConverter tc = NativeMappedConverter.getInstance(type);
/** Write the given array of Pointer to native memory. * @param bOff byte offset from pointer into which data is copied * @param buf <code>Pointer</code> array from which to copy * @param index array index from which to start copying * @param length number of elements from <code>buf</code> that must be * copied */ public void write(long bOff, Pointer[] buf, int index, int length) { for (int i=0;i < length;i++) { setPointer(bOff + i * Pointer.SIZE, buf[index + i]); } }
/** Write the given array of Pointer to native memory. * @param bOff byte offset from pointer into which data is copied * @param buf <code>Pointer</code> array from which to copy * @param index array index from which to start copying * @param length number of elements from <code>buf</code> that must be * copied */ public void write(long bOff, Pointer[] buf, int index, int length) { for (int i=0;i < length;i++) { setPointer(bOff + i * Pointer.SIZE, buf[index + i]); } }
Pointer modules = new Memory(Pointer.SIZE * length); int offset = 0; for (h: hmodules) { modules.setPointer(Pointer.SIZE * offset, h.getPointer()) offset += 1; }
public LPWSTRByReference() { super(Pointer.SIZE); // memory cleanup getPointer().setPointer(0, null); }
public LPWSTRByReference() { super(Pointer.SIZE); // memory cleanup getPointer().setPointer(0, null); }
/** * Indirect the native pointer to <code>malloc</code> space, a la * <code>Pointer.setPointer</code>. But this method performs * a bounds checks to ensure that the indirection does not cause memory * outside the <code>malloc</code>ed space to be accessed. * * @see Pointer#setPointer */ public void setPointer(long offset, Pointer value) { boundsCheck(offset, Pointer.SIZE); super.setPointer(offset, value); }
public void set(T value) { this.value = value; getPointer().setPointer(0, value.getPointer()); } }
public void set(T value) { this.value = value; getPointer().setPointer(0, value.getPointer()); } }
public void setValue(HWND h) { getPointer().setPointer(0, h != null ? h.getPointer() : null); } public HWND getValue() {
public void setValue(HKEY h) { getPointer().setPointer(0, h != null ? h.getPointer() : null); }
public void setValue(BSTR value) { this.getPointer().setPointer(0, value.getPointer()); }
public FlowReturn callback(BaseSrc element, long offset, int size, Pointer bufRef) { try { Buffer buffer = new Buffer(size); //System.out.println("Sending buf=" + buf); FlowReturn retVal = ((CustomSrc) element).srcFillBuffer(offset, size, buffer); bufRef.setPointer(0, buffer.getAddress()); buffer.disown(); return retVal; } catch (Exception ex) { return FlowReturn.UNEXPECTED; } }
public void set(S value) { if (isByValue()) { Pointer p = getPointer(); int s = value.size(); p.write(0, value.getPointer().getByteArray(0, s), 0, s); get(); } else { this.value = value; getPointer().setPointer(0, value.getPointer()); } } protected boolean isByValue() {
public void set(S value) { if (isByValue()) { Pointer p = getPointer(); int s = value.size(); p.write(0, value.getPointer().getByteArray(0, s), 0, s); get(); } else { this.value = value; getPointer().setPointer(0, value.getPointer()); } } protected boolean isByValue() {
public void set(U value) { if (isByValue()) { Pointer p = getPointer(); int s = value.size(); p.write(0, value.getPointer().getByteArray(0, s), 0, s); get(); } else { this.value = value; getPointer().setPointer(0, value.getPointer()); } } protected boolean isByValue() {
public void set(U value) { if (isByValue()) { Pointer p = getPointer(); int s = value.size(); p.write(0, value.getPointer().getByteArray(0, s), 0, s); get(); } else { this.value = value; getPointer().setPointer(0, value.getPointer()); } } protected boolean isByValue() {