public void setValue(byte value) { getPointer().setByte(0, value); }
/** * Indirect the native pointer to <code>malloc</code> space, a la * <code>Pointer.setByte</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#setByte */ @Override public void setByte(long offset, byte value) { boundsCheck(offset, 1); super.setByte(offset, value); }
/** * Copy string <code>value</code> to the location being pointed to, using * the requested encoding. * * @param offset byte offset from pointer at which characters in * <code>value</code> must be set * @param value <code>java.lang.String</code> value to set * @param encoding desired encoding */ public void setString(long offset, String value, String encoding) { byte[] data = Native.getBytes(value, encoding); write(offset, data, 0, data.length); setByte(offset + data.length, (byte)0); }
/** Create a native string (NUL-terminated array of <code>char</code>), * using the requested encoding. */ public NativeString(String string, String encoding) { if (string == null) { throw new NullPointerException("String must not be null"); } // Allocate the memory to hold the string. Note, we have to // make this 1 element longer in order to accommodate the terminating // NUL (which is generated in Pointer.setString()). this.encoding = encoding; if (WIDE_STRING.equals(this.encoding)) { int len = (string.length() + 1 ) * Native.WCHAR_SIZE; pointer = new StringMemory(len); pointer.setWideString(0, string); } else { byte[] data = Native.getBytes(string, encoding); pointer = new StringMemory(data.length + 1); pointer.write(0, data, 0, data.length); pointer.setByte(data.length, (byte)0); } }
setInt(offset, Boolean.TRUE.equals(value) ? -1 : 0); } else if (type == byte.class || type == Byte.class) { setByte(offset, value == null ? 0 : ((Byte)value).byteValue()); } else if (type == short.class || type == Short.class) { setShort(offset, value == null ? 0 : ((Short)value).shortValue());
public void putByte(long offset, byte value) { ptr.setByte(offset, value); }
static Pointer setbooleanArray(boolean [] input) { Pointer output = new Memory(input.length*Native.getNativeSize(Byte.TYPE)); for (int i=0;i<input.length;i++){ output.setByte(i, (byte) (input[i] ? 1:0)); }; return output; };
@Override public AlignedDirectByteBuffer put(byte b) { pointer.setByte(safeIncrementForPut(), b); return this; }
/** * Indirect the native pointer to <code>malloc</code> space, a la * <code>Pointer.setByte</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#setByte */ public void setByte(long offset, byte value) { boundsCheck(offset, 1); super.setByte(offset, value); }
@Override public AlignedDirectByteBuffer put(byte b) { pointer.setByte(safeIncrementForPut(), b); return this; }
public void setValue(byte value) { getPointer().setByte(0, value); }
/** * Indirect the native pointer to <code>malloc</code> space, a la * <code>Pointer.setByte</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#setByte */ @Override public void setByte(long offset, byte value) { boundsCheck(offset, 1); super.setByte(offset, value); }
public void setValue(byte value) { getPointer().setByte(0, value); }
/** * Sets the value. * * @param value the new value */ public void setValue(CHAR value) { getPointer().setByte(0, value.byteValue()); }
public void setValue(CHAR value) { getPointer().setByte(0, value.byteValue()); }
private static class MemberOrder { public int first; public int middle; public int last; }
/** * Copy string <code>value</code> to the location being pointed to, using * the requested encoding. * * @param offset byte offset from pointer at which characters in * <code>value</code> must be set * @param value <code>java.lang.String</code> value to set * @param encoding desired encoding */ public void setString(long offset, String value, String encoding) { byte[] data = Native.getBytes(value, encoding); write(offset, data, 0, data.length); setByte(offset + data.length, (byte)0); }
private byte[] install32(String mapname, COPYDATASTRUCT32 cds){ cds.dwData = 0x804e50ba; // AGENT_COPYDATA_ID cds.cbData = mapname.length()+1; cds.lpData = new Memory(mapname.length()+1); { byte[] foo = mapname.getBytes(); cds.lpData.write(0, foo, 0, foo.length); cds.lpData.setByte(foo.length, (byte)0); cds.write(); } byte[] data = new byte[12]; Pointer cdsp = cds.getPointer(); cdsp.read(0, data, 0, 12); return data; }
private byte[] install64(String mapname, COPYDATASTRUCT64 cds){ cds.dwData = 0x804e50ba; // AGENT_COPYDATA_ID cds.cbData = mapname.length()+1; cds.lpData = new Memory(mapname.length()+1); { byte[] foo = mapname.getBytes(); cds.lpData.write(0, foo, 0, foo.length); cds.lpData.setByte(foo.length, (byte)0); cds.write(); } byte[] data = new byte[24]; Pointer cdsp = cds.getPointer(); cdsp.read(0, data, 0, 24); return data; }
private byte[] install64(String mapname, COPYDATASTRUCT64 cds){ cds.dwData = 0x804e50ba; // AGENT_COPYDATA_ID cds.cbData = mapname.length()+1; cds.lpData = new Memory(mapname.length()+1); { byte[] foo = mapname.getBytes(); cds.lpData.write(0, foo, 0, foo.length); cds.lpData.setByte(foo.length, (byte)0); cds.write(); } byte[] data = new byte[24]; Pointer cdsp = cds.getPointer(); cdsp.read(0, data, 0, 24); return data; }