Java Code Examples for com.sun.jna.Native#SIZE_T_SIZE

The following examples show how to use com.sun.jna.Native#SIZE_T_SIZE . 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: AbstractSocket.java    From jnanomsg with Apache License 2.0 6 votes vote down vote up
/**
 * Get file descriptor.
 *
 * @return file descriptor.
 */
private synchronized int getSocketFd(SocketOption opt) throws IOException {
  final int flag = opt.value();
  final IntByReference fd = new IntByReference();
  final IntByReference size_t = new IntByReference(Native.SIZE_T_SIZE);

  final int rc = NativeLibrary.nn_getsockopt(this.fd,
                                             OptionLevel.NN_SOL_SOCKET.value(),
                                             flag, fd.getPointer(),
                                             size_t.getPointer());
  if (rc < 0) {
    Nanomsg.handleError(rc);
  }

  return fd.getValue();
}
 
Example 2
Source File: SizeTByReference.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void setValue(SizeT value) {
  Pointer p = getPointer();
  if (Native.SIZE_T_SIZE == 8) {
    p.setLong(0, value.longValue());
  } else {
    p.setInt(0, value.intValue());
  }
}
 
Example 3
Source File: SizeT.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public SizeT(long value) {
  super(Native.SIZE_T_SIZE, value, true);
}
 
Example 4
Source File: SizeTByReference.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public SizeTByReference(SizeT value) {
  super(Native.SIZE_T_SIZE);
  setValue(value);
}
 
Example 5
Source File: SizeTByReference.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public SizeT getValue() {
  Pointer p = getPointer();
  return new SizeT(Native.SIZE_T_SIZE == 8 ? p.getLong(0) : p.getInt(0));
}
 
Example 6
Source File: JNAKernel32Library.java    From crate with Apache License 2.0 4 votes vote down vote up
SizeT(long value) {
    super(Native.SIZE_T_SIZE, value);
}
 
Example 7
Source File: Size_t.java    From argon2-jvm with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Constructor.
 *
 * @param value Value.
 */
public Size_t(long value) {
    super(Native.SIZE_T_SIZE, value);
}