本文整理了Java中com.sun.jna.Memory.getInt()
方法的一些代码示例,展示了Memory.getInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Memory.getInt()
方法的具体详情如下:
包路径:com.sun.jna.Memory
类名称:Memory
方法名:getInt
[英]Indirect the native pointer to malloc
space, a la Pointer.getInt
. But this method performs a bounds checks to ensure that the indirection does not cause memory outside the malloc
ed space to be accessed.
[中]间接指向malloc
空间的本机指针,即la[$1$]。但该方法执行边界检查,以确保间接寻址不会导致malloc
ed空间之外的内存被访问。
代码示例来源:origin: jenkinsci/jenkins
public synchronized List<String> getArguments() {
if(arguments!=null)
return arguments;
arguments = new ArrayList<String>(argc);
if (argc == 0) {
return arguments;
}
int psize = b64 ? 8 : 4;
Memory m = new Memory(psize);
try {
if(LOGGER.isLoggable(FINER))
LOGGER.finer("Reading "+getFile("as"));
int fd = LIBC.open(getFile("as").getAbsolutePath(), 0);
try {
for( int n=0; n<argc; n++ ) {
// read a pointer to one entry
LIBC.pread(fd, m, new NativeLong(psize), new NativeLong(argp+n*psize));
long addr = b64 ? m.getLong(0) : to64(m.getInt(0));
arguments.add(readLine(fd, addr, "argv["+ n +"]"));
}
} finally {
LIBC.close(fd);
}
} catch (IOException | LastErrorException e) {
// failed to read. this can happen under normal circumstances (most notably permission denied)
// so don't report this as an error.
}
arguments = Collections.unmodifiableList(arguments);
return arguments;
}
代码示例来源:origin: jenkinsci/jenkins
int pid = m.getInt(base+ kinfo_proc_pid_offset);
int ppid = m.getInt(base+ kinfo_proc_ppid_offset);
代码示例来源:origin: jenkinsci/jenkins
long argp = b64 ? m.getLong(0) : to64(m.getInt(0));
long addr = b64 ? m.getLong(0) : to64(m.getInt(0));
代码示例来源:origin: jenkinsci/jenkins
long addr = b64 ? m.getLong(0) : to64(m.getInt(0));
if (addr == 0) // completed the walk
break;
代码示例来源:origin: jenkinsci/jenkins
long envp = b64 ? m.getLong(0) : to64(m.getInt(0));
long addr = b64 ? m.getLong(0) : to64(m.getInt(0));
代码示例来源:origin: apache/nifi
int newMaxSize = used.getInt(0);
int usedBytes = used.getInt(0);
String string = StandardCharsets.UTF_16LE.decode(buffer.getByteBuffer(0, usedBytes)).toString();
if (string.endsWith("\u0000")) {
代码示例来源:origin: io.dvlopt/linux-gpio
/**
* Retrieves the number of this line.
*
* @return The number of the line.
*/
public int getLine() {
return this.memory.getInt( NativeGpioLineInfo.OFFSET_LINE ) ;
}
代码示例来源:origin: io.dvlopt/linux-gpio
/**
* Retrieves how many lines this GPIO device can handle, at most 64.
*
* @return The number of lines.
*/
public int getLines() {
return this.memory.getInt( NativeGpioChipInfo.OFFSET_LINES ) ;
}
代码示例来源:origin: io.dvlopt/linux-gpio
/**
* Retrieves which line will be requested.
*
* @return Number of the line.
*/
public int getLine() {
return this.memory.getInt( NativeGpioEventRequest.OFFSET_LINE ) ;
}
代码示例来源:origin: org.rococoa/rococoa-core
@Override public Object readFrom(Memory buffer, Class<?> type) {
return buffer.getInt(0);
}
@Override public Memory bufferForResult(Object methodCallResult) {
代码示例来源:origin: io.dvlopt/linux-gpio
int getFD() {
return this.memory.getInt( NativeGpioHandleRequest.OFFSET_FD ) ;
}
代码示例来源:origin: io.dvlopt/linux-gpio
int getFD() {
return this.memory.getInt( NativeGpioEventRequest.OFFSET_FD ) ;
}
代码示例来源:origin: io.dvlopt/linux-gpio
private int getRawFlags() {
return this.memory.getInt( NativeGpioLineInfo.OFFSET_FLAGS ) ;
}
代码示例来源:origin: io.dvlopt/linux-gpio
/**
* Retrieves the flags specifying how the lines will be handled.
*
* @return The flags.
*/
public GpioFlags getFlags() {
return new GpioFlags().fromRequest( this.memory.getInt( NativeGpioHandleRequest.OFFSET_FLAGS ) ) ;
}
代码示例来源:origin: io.dvlopt/linux-gpio
/**
* Retrieves the flags describing how the lines involved in this request should be handled.
*
* @return Flags.
*/
public GpioFlags getFlags() {
return new GpioFlags().fromRequest( this.memory.getInt( NativeGpioEventRequest.OFFSET_HANDLE_FLAGS ) ) ;
}
代码示例来源:origin: stackoverflow.com
public static void main(String... args)
{
int pid = getProcessId("Solitaire");
Pointer process = openProcess(PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_VM_OPERATION, pid);
long dynAddress = findDynAddress(process,offsets,baseAddress);
Memory scoreMem = readMemory(process,dynAddress,4);
int score = scoreMem.getInt(0);
System.out.println(score);
}
public static Memory readMemory(Pointer process, long address, int bytesToRead) {
IntByReference read = new IntByReference(0);
Memory output = new Memory(bytesToRead);
kernel32.ReadProcessMemory(process, address, output, bytesToRead, read);
return output;
}
代码示例来源:origin: stackoverflow.com
pointerAddress = ((pTemp.getInt(0)+offsets[i]));
代码示例来源:origin: org.zeromq/zeromq-scala-binding
private int getIntSockopt(int option) {
Memory value = new Memory(Integer.SIZE / 8);
LongByReference length = new LongByReference(Integer.SIZE / 8);
zmq.zmq_getsockopt(ptr, option, value, length);
return value.getInt(0);
}
代码示例来源:origin: stackoverflow.com
public static void main(String... args)
{
int pid = getProcessId("Solitaire");
Pointer process = openProcess(PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_VM_OPERATION, pid);
long dynAddress = findDynAddress(process,offsets,baseAddress);
Memory scoreMem = readMemory(process,dynAddress,4);
int score = scoreMem.getInt(0);
System.out.println(score);
byte[] newScore = new byte[]{0x22,0x22,0x22,0x22};
writeMemory(process, dynAddress, newScore);
}
public static void writeMemory(Pointer process, long address, byte[] data)
{
int size = data.length;
Memory toWrite = new Memory(size);
for(int i = 0; i < size; i++)
{
toWrite.setByte(i, data[i]);
}
boolean b = kernel32.WriteProcessMemory(process, address, toWrite, size, null);
}
代码示例来源:origin: io.dvlopt/linux-gpio
/**
* Adds a GPIO line to the request.
* <p>
* A handle can drive at most 64 lines at once.
*
* @param lineNumber
* Which line.
*
* @return A GPIO line useful for handling a buffer.
*
* @see GpioBuffer
*/
public GpioLine addLine( int lineNumber ) {
int index = this.memory.getInt( NativeGpioHandleRequest.OFFSET_LINES ) ;
this.memory.setInt( NativeGpioHandleRequest.OFFSET_LINE_OFFSETS + 4 * index ,
lineNumber ) ;
this.memory.setInt( NativeGpioHandleRequest.OFFSET_LINES ,
index + 1 ) ;
return new GpioLine( lineNumber ,
index ) ;
}
内容来源于网络,如有侵权,请联系作者删除!